getIntersect() + $this->getSlope() * $xValue; } // function getValueOfYForX() public function getValueOfXForY($yValue) { return ($yValue - $this->getIntersect()) / $this->getSlope(); } // function getValueOfXForY() public function getEquation($dp=0) { $slope = $this->getSlope($dp); $intersect = $this->getIntersect($dp); return 'Y = '.$intersect.' + '.$slope.' * X'; } // function getEquation() private function _linear_regression($yValues, $xValues, $const) { $this->_leastSquareFit($yValues, $xValues,$const); } // function _linear_regression() function __construct($yValues, $xValues=array(), $const=True) { if (parent::__construct($yValues, $xValues) !== False) { $this->_linear_regression($yValues, $xValues, $const); } } // function __construct() } // class linearBestFit