function regression_error($distribution_variance, $population, $r_z = 1.96) { /* Computes the variance error */ if ($population > 0) { $stats = new Stats(); $ppf = AChiSq($stats::erf($r_z / sqrt(2)), $population); if ($ppf != 0) { $error = $distribution_variance * ($population - 1) / $ppf; $error = $error * pow(sqrt($population) + $r_z, 2); return sqrt($error / $population); } } return NAN; }
function calppm($conf, $fails, $total) { $E5 = $conf / 100; $F5 = $fails; $G5 = $total; $I5 = AChiSq(1 - $E5, 2 * ($F5 + 1)) * 1000000 / (2 * $G5); return round($I5); }