You are here

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

* KURT * * Returns the kurtosis of a data set. Kurtosis characterizes the relative peakedness * or flatness of a distribution compared with the normal distribution. Positive * kurtosis indicates a relatively peaked distribution. Negative kurtosis indicates a * relatively flat distribution. * *

Parameters

array Data Series: * @return float

File

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

Class

PHPExcel_Calculation_Statistical
PHPExcel_Calculation_Statistical

Code

public static function KURT() {
  $aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args());
  $mean = self::AVERAGE($aArgs);
  $stdDev = self::STDEV($aArgs);
  if ($stdDev > 0) {
    $count = $summer = 0;

    // Loop through arguments
    foreach ($aArgs as $k => $arg) {
      if (is_bool($arg) && !PHPExcel_Calculation_Functions::isMatrixValue($k)) {
      }
      else {

        // Is it a numeric value?
        if (is_numeric($arg) && !is_string($arg)) {
          $summer += pow(($arg - $mean) / $stdDev, 4);
          ++$count;
        }
      }
    }

    // Return
    if ($count > 3) {
      return $summer * ($count * ($count + 1) / (($count - 1) * ($count - 2) * ($count - 3))) - 3 * pow($count - 1, 2) / (($count - 2) * ($count - 3));
    }
  }
  return PHPExcel_Calculation_Functions::DIV0();
}