You are here

public static function PHPExcel_Calculation_Statistical::CONFIDENCE 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::CONFIDENCE()

* CONFIDENCE * * Returns the confidence interval for a population mean * *

Parameters

float $alpha: * @param float $stdDev Standard Deviation * @param float $size * @return float *

File

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

Class

PHPExcel_Calculation_Statistical
PHPExcel_Calculation_Statistical

Code

public static function CONFIDENCE($alpha, $stdDev, $size) {
  $alpha = PHPExcel_Calculation_Functions::flattenSingleValue($alpha);
  $stdDev = PHPExcel_Calculation_Functions::flattenSingleValue($stdDev);
  $size = floor(PHPExcel_Calculation_Functions::flattenSingleValue($size));
  if (is_numeric($alpha) && is_numeric($stdDev) && is_numeric($size)) {
    if ($alpha <= 0 || $alpha >= 1) {
      return PHPExcel_Calculation_Functions::NaN();
    }
    if ($stdDev <= 0 || $size < 1) {
      return PHPExcel_Calculation_Functions::NaN();
    }
    return self::NORMSINV(1 - $alpha / 2) * $stdDev / sqrt($size);
  }
  return PHPExcel_Calculation_Functions::VALUE();
}