MathPHP\Probability\Distribution\Continuous\StudentT::inverse2Tails PHP Метод

inverse2Tails() публичный статический Метод

Inverse 2 tails Find t such that the area greater than t and the area beneath -t is p.
public static inverse2Tails ( number $p, number ) : number
$p number Proportion of area
number Degrees of freedom
Результат number t-score
    public static function inverse2Tails($p, $ν)
    {
        Support::checkLimits(self::LIMITS, ['ν' => $ν]);
        return self::inverse(1 - $p / 2, $ν);
    }

Usage Example

Пример #1
0
 /**
  * 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);
 }