/** * The prediction interval of the regression * _________________ * /1 1 (x - x̄)² * PI(x,p,q) = t * sy * / - + - + -------- * √ q n SSx * * Where: * t is the critical t for the p value * sy is the estimated standard deviation of y * q is the number of replications * n is the number of data points * x̄ is the average of the x values * SSx = ∑(x - x̄)² * * If $p = .05, then we can say we are 95% confidence that the future averages of $q trials at $x * will be within an interval of evaluate($x) ± PI($x, .05, $q). * * @param number $x * @param number $p 0 < p < 1 The P value to use * @param int $q Number of trials * * @return number */ public function PI($x, $p, $q = 1) { $V = $this->regressionVariance($x) + 1 / $q; $σ² = $this->meanSquareResidual(); // The t-value $t = StudentT::inverse2Tails($p, $this->ν); return $t * sqrt($σ² * $V); }