MathPHP\Statistics\Significance::zTest PHP Метод

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

https://en.wikipedia.org/wiki/Z-test Hₐ - H₀ M - μ M - μ M - μ z = ------- = ----- = ----- = ----- σ σ SEM σ/√n p1 = CDF below if left tailed = CDF above if right tailed p2 = CDF outside
public static zTest ( number $Hₐ, integer $n, number $H₀, number ) : array
$Hₐ number Alternate hypothesis (M Sample mean)
$n integer Sample size
$H₀ number Null hypothesis (μ Population mean)
number SD of population (Standard error of the mean)
Результат array [ z => z score p1 => one-tailed p value (left or right tail depends on how Hₐ differs from H₀) p2 => two-tailed p value ]
    public static function zTest($Hₐ, $n, $H₀, $σ) : array
    {
        // Calculate z score (test statistic)
        $sem = self::sem($σ, $n);
        $z = self::zScore($Hₐ, $H₀, $sem, self::Z_RAW_VALUE);
        // One- and two-tailed P values
        if ($Hₐ < $H₀) {
            $p1 = StandardNormal::CDF($z);
        } else {
            $p1 = StandardNormal::above($z);
        }
        $p2 = StandardNormal::outside(-abs($z), abs($z));
        return ['z' => $z, 'p1' => $p1, 'p2' => $p2];
    }