> $x Obersved x values * @param array> $y Observed y values * * @return array [b0 => ?, b1 => ?] * * @since 1.0.0 */ public static function getRegression(array $x, array $y) : array { $X = new Matrix(\count($x), \count($x[0])); $X->setMatrix($x); $XT = $X->transpose(); $Y = new Matrix(\count($y)); $Y->setMatrix($y); return $XT->mult($X)->inverse()->mult($XT)->mult($Y)->toArray(); } /** * {@inheritdoc} */ public static function getSlope(float $b1, float $y, float $x) : float { return 0.0; } /** * {@inheritdoc} */ public static function getElasticity(float $b1, float $y, float $x) : float { return 0.0; } }