You are here

public static function PHPExcel_Calculation_Statistical::LOGINV in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Statistical.php \PHPExcel_Calculation_Statistical::LOGINV()

* LOGINV * * Returns the inverse of the normal cumulative distribution * *

Parameters

float $probability: * @param float $mean * @param float $stdDev * @return float * * @todo Try implementing P J Acklam's refinement algorithm for greater * accuracy if I can get my head round the mathematics * (as described at) http://home.online.no/~pjacklam/notes/invnorm/

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Statistical.php, line 2074

Class

PHPExcel_Calculation_Statistical
PHPExcel_Calculation_Statistical

Code

public static function LOGINV($probability, $mean, $stdDev) {
  $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability);
  $mean = PHPExcel_Calculation_Functions::flattenSingleValue($mean);
  $stdDev = PHPExcel_Calculation_Functions::flattenSingleValue($stdDev);
  if (is_numeric($probability) && is_numeric($mean) && is_numeric($stdDev)) {
    if ($probability < 0 || $probability > 1 || $stdDev <= 0) {
      return PHPExcel_Calculation_Functions::NaN();
    }
    return exp($mean + $stdDev * self::NORMSINV($probability));
  }
  return PHPExcel_Calculation_Functions::VALUE();
}