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c@7 msL]`Gnfa^^gB78*zRϧxjJ(mYvn4zŽN2}#O )ճZDQq*7&wy3d<oA LkpGFՓSĉN ~-Xb x%Rc)v%Т˘y#":ZZ~IRD 8=);+i?M~|𖇒;ٛ~SHByxƙ0F>,U1ƞp4;lY*nHpc'#I>B"#{Up5l-4:mrx;INTQ‰HDFUEk V$E#­@l*/98&gɕxZŪo a];UYWѩS uM`E&5V-}vu|Pm0/d-Q КOP첾Wo;AywzT1MY9 (Ƒ)p! i포&x)j;N&'YrG~`}{&c)yR5Z'V2o@; O/;"k0/iQ)&BQ~o43#lǡI{?@v@y~1yD]6.S_ՐleDי! 聻HY7&ؐOϬg!avqXDi0rn y\;12#KsO\f{}QW=f5OIS2H0_bŠpWN݋. w_i3- 6P\Ş^ V}Ve!1杝*%7㿽=LZ"IvalueCount; ++$i) { for ($j = 0; $j <= $order; ++$j) { $A[$i][$j] = $xValues[$i] ** $j; } } for ($i = 0; $i < $this->valueCount; ++$i) { $B[$i] = [$yValues[$i]]; } $matrixA = new Matrix($A); $matrixB = new Matrix($B); $C = $matrixA->solve($matrixB); $coefficients = []; for ($i = 0; $i < $C->rows; ++$i) { $r = $C->getValue($i + 1, 1); // row and column are origin-1 if (abs($r) <= 10 ** (-9)) { $r = 0; } $coefficients[] = $r; } $this->intersect = array_shift($coefficients); // Phpstan (and maybe Scrutinizer) are correct //* @phpstan-ignore-next-line $this->slope = $coefficients; $this->calculateGoodnessOfFit($x_sum, $y_sum, $xx_sum, $yy_sum, $xy_sum, 0, 0, 0); foreach ($this->xValues as $xKey => $xValue) { $this->yBestFitValues[$xKey] = $this->getValueOfYForX($xValue); } } /** * Define the regression and calculate the goodness of fit for a set of X and Y data values. * * @param int $order Order of Polynomial for this regression * @param float[] $yValues The set of Y-values for this regression * @param float[] $xValues The set of X-values for this regression */ public function __construct($order, $yValues, $xValues = []) { parent::__construct($yValues, $xValues); if (!$this->error) { if ($order < $this->valueCount) { $this->bestFitType .= '_' . $order; $this->order = $order; $this->polynomialRegression($order, $yValues, $xValues); if (($this->getGoodnessOfFit() < 0.0) || ($this->getGoodnessOfFit() > 1.0)) { $this->error = true; } } else { $this->error = true; } } } }