You are here

public static function PHPExcel_Calculation_Statistical::STANDARDIZE in Loft Data Grids 6.2

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

* STANDARDIZE * * Returns a normalized value from a distribution characterized by mean and standard_dev. * *

Parameters

float $value Value to normalize: * @param float $mean Mean Value * @param float $stdDev Standard Deviation * @return float Standardized value

File

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

Class

PHPExcel_Calculation_Statistical
PHPExcel_Calculation_Statistical

Code

public static function STANDARDIZE($value, $mean, $stdDev) {
  $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
  $mean = PHPExcel_Calculation_Functions::flattenSingleValue($mean);
  $stdDev = PHPExcel_Calculation_Functions::flattenSingleValue($stdDev);
  if (is_numeric($value) && is_numeric($mean) && is_numeric($stdDev)) {
    if ($stdDev <= 0) {
      return PHPExcel_Calculation_Functions::NaN();
    }
    return ($value - $mean) / $stdDev;
  }
  return PHPExcel_Calculation_Functions::VALUE();
}