You are here

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

* SKEW * * Returns the skewness of a distribution. Skewness characterizes the degree of asymmetry * of a distribution around its mean. Positive skewness indicates a distribution with an * asymmetric tail extending toward more positive values. Negative skewness indicates a * distribution with an asymmetric tail extending toward more negative values. * *

Parameters

array Data Series: * @return float

File

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

Class

PHPExcel_Calculation_Statistical
PHPExcel_Calculation_Statistical

Code

public static function SKEW() {
  $aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args());
  $mean = self::AVERAGE($aArgs);
  $stdDev = self::STDEV($aArgs);
  $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, 3);
        ++$count;
      }
    }
  }

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