|
@@ 2069-2081 (lines=13) @@
|
| 2066 |
|
* accuracy if I can get my head round the mathematics |
| 2067 |
|
* (as described at) http://home.online.no/~pjacklam/notes/invnorm/ |
| 2068 |
|
*/ |
| 2069 |
|
public static function LOGINV($probability, $mean, $stdDev) { |
| 2070 |
|
$probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability); |
| 2071 |
|
$mean = PHPExcel_Calculation_Functions::flattenSingleValue($mean); |
| 2072 |
|
$stdDev = PHPExcel_Calculation_Functions::flattenSingleValue($stdDev); |
| 2073 |
|
|
| 2074 |
|
if ((is_numeric($probability)) && (is_numeric($mean)) && (is_numeric($stdDev))) { |
| 2075 |
|
if (($probability < 0) || ($probability > 1) || ($stdDev <= 0)) { |
| 2076 |
|
return PHPExcel_Calculation_Functions::NaN(); |
| 2077 |
|
} |
| 2078 |
|
return exp($mean + $stdDev * self::NORMSINV($probability)); |
| 2079 |
|
} |
| 2080 |
|
return PHPExcel_Calculation_Functions::VALUE(); |
| 2081 |
|
} // function LOGINV() |
| 2082 |
|
|
| 2083 |
|
|
| 2084 |
|
/** |
|
@@ 2543-2558 (lines=16) @@
|
| 2540 |
|
* @return float |
| 2541 |
|
* |
| 2542 |
|
*/ |
| 2543 |
|
public static function NORMINV($probability,$mean,$stdDev) { |
| 2544 |
|
$probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability); |
| 2545 |
|
$mean = PHPExcel_Calculation_Functions::flattenSingleValue($mean); |
| 2546 |
|
$stdDev = PHPExcel_Calculation_Functions::flattenSingleValue($stdDev); |
| 2547 |
|
|
| 2548 |
|
if ((is_numeric($probability)) && (is_numeric($mean)) && (is_numeric($stdDev))) { |
| 2549 |
|
if (($probability < 0) || ($probability > 1)) { |
| 2550 |
|
return PHPExcel_Calculation_Functions::NaN(); |
| 2551 |
|
} |
| 2552 |
|
if ($stdDev < 0) { |
| 2553 |
|
return PHPExcel_Calculation_Functions::NaN(); |
| 2554 |
|
} |
| 2555 |
|
return (self::_inverse_ncdf($probability) * $stdDev) + $mean; |
| 2556 |
|
} |
| 2557 |
|
return PHPExcel_Calculation_Functions::VALUE(); |
| 2558 |
|
} // function NORMINV() |
| 2559 |
|
|
| 2560 |
|
|
| 2561 |
|
/** |