private static function PHPExcel_Calculation_Statistical::_inverse_ncdf in Loft Data Grids 7.2
Same name and namespace in other branches
- 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Statistical.php \PHPExcel_Calculation_Statistical::_inverse_ncdf()
1 call to PHPExcel_Calculation_Statistical::_inverse_ncdf()
- PHPExcel_Calculation_Statistical::NORMINV in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Statistical.php
- * NORMINV
*
* Returns the inverse of the normal cumulative distribution for the specified mean and standard deviation.
*
*
File
- vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Statistical.php, line 474
Class
- PHPExcel_Calculation_Statistical
- PHPExcel_Calculation_Statistical
Code
private static function _inverse_ncdf($p) {
static $a = array(
1 => -39.69683028665376,
2 => 220.9460984245205,
3 => -275.9285104469687,
4 => 138.357751867269,
5 => -30.66479806614716,
6 => 2.506628277459239,
);
static $b = array(
1 => -54.47609879822406,
2 => 161.5858368580409,
3 => -155.6989798598866,
4 => 66.80131188771972,
5 => -13.28068155288572,
);
static $c = array(
1 => -0.007784894002430293,
2 => -0.3223964580411365,
3 => -2.400758277161838,
4 => -2.549732539343734,
5 => 4.374664141464968,
6 => 2.938163982698783,
);
static $d = array(
1 => 0.007784695709041462,
2 => 0.3224671290700398,
3 => 2.445134137142996,
4 => 3.754408661907416,
);
$p_low = 0.02425;
$p_high = 1 - $p_low;
if (0 < $p && $p < $p_low) {
$q = sqrt(-2 * log($p));
return ((((($c[1] * $q + $c[2]) * $q + $c[3]) * $q + $c[4]) * $q + $c[5]) * $q + $c[6]) / (((($d[1] * $q + $d[2]) * $q + $d[3]) * $q + $d[4]) * $q + 1);
}
elseif ($p_low <= $p && $p <= $p_high) {
$q = $p - 0.5;
$r = $q * $q;
return ((((($a[1] * $r + $a[2]) * $r + $a[3]) * $r + $a[4]) * $r + $a[5]) * $r + $a[6]) * $q / ((((($b[1] * $r + $b[2]) * $r + $b[3]) * $r + $b[4]) * $r + $b[5]) * $r + 1);
}
elseif ($p_high < $p && $p < 1) {
$q = sqrt(-2 * log(1 - $p));
return -((((($c[1] * $q + $c[2]) * $q + $c[3]) * $q + $c[4]) * $q + $c[5]) * $q + $c[6]) / (((($d[1] * $q + $d[2]) * $q + $d[3]) * $q + $d[4]) * $q + 1);
}
return PHPExcel_Calculation_Functions::NULL();
}