Exemplo n.º 1
0
 /**
  * Define the regression and calculate the goodness of fit for a set of X and Y data values
  *
  * @param    float[]        $yValues    The set of Y-values for this regression
  * @param    float[]        $xValues    The set of X-values for this regression
  * @param    boolean        $const
  */
 public function __construct($yValues, $xValues = array(), $const = true)
 {
     if (parent::__construct($yValues, $xValues) !== false) {
         $this->linearRegression($yValues, $xValues, $const);
     }
 }
Exemplo n.º 2
0
 /**
  * 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
  * @param    boolean        $const
  */
 public function __construct($order, $yValues, $xValues = array(), $const = true)
 {
     if (parent::__construct($yValues, $xValues) !== false) {
         if ($order < $this->valueCount) {
             $this->bestFitType .= '_' . $order;
             $this->order = $order;
             $this->polynomialRegression($order, $yValues, $xValues, $const);
             if ($this->getGoodnessOfFit() < 0.0 || $this->getGoodnessOfFit() > 1.0) {
                 $this->_error = true;
             }
         } else {
             $this->_error = true;
         }
     }
 }