48                $retVal += $value * $xValue ** (
$key + 1);
 
   83                $equation .= 
' + ' . $value . 
' * X';
 
   85                    $equation .= 
'^' . (
$key + 1);
 
  104            foreach ($this->slope as $coefficient) {
 
  105                $coefficients[] = round($coefficient, $dp);
 
  109            return $coefficients;
 
  132        $xx_sum = $xy_sum = $yy_sum = 0;
 
  149            for ($j = 0; $j <= 
$order; ++$j) {
 
  156        $matrixA = 
new Matrix($A);
 
  157        $matrixB = 
new Matrix($B);
 
  158        $C = $matrixA->solve($matrixB);
 
  161        for (
$i = 0; 
$i < $C->getRowDimension(); ++
$i) {
 
  163            if (abs(
$r) <= 10 ** (-9)) {
 
  166            $coefficients[] = 
$r;
 
  169        $this->intersect = array_shift($coefficients);
 
  170        $this->slope = $coefficients;
 
  173        foreach ($this->xValues as $xKey => $xValue) {
 
  190            if ($order < $this->valueCount) {
 
  191                $this->bestFitType .= 
'_' . 
$order;
 
An exception for terminatinating execution or to throw for unit testing.
getIntersect($dp=0)
Return the Value of X where it intersects Y = 0.
getGoodnessOfFit($dp=0)
Return the goodness of fit for this regression.
calculateGoodnessOfFit($sumX, $sumY, $sumX2, $sumY2, $sumXY, $meanX, $meanY, $const)
getValueOfXForY($yValue)
Return the X-Value for a specified value of Y.
getOrder()
Return the order of this polynomial.
getEquation($dp=0)
Return the Equation of the best-fit line.
polynomialRegression($order, $yValues, $xValues)
Execute the regression and calculate the goodness of fit for a set of X and Y data values.
getValueOfYForX($xValue)
Return the Y-Value for a specified value of X.
getSlope($dp=0)
Return the Slope of the line.
__construct($order, $yValues, $xValues=[])
Define the regression and calculate the goodness of fit for a set of X and Y data values.
error($a_errmsg)
set error message @access public
Class for the creating "special" Matrices.