You are here

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

* CHIDIST * * Returns the one-tailed probability of the chi-squared distribution. * *

Parameters

float $value Value for the function: * @param float $degrees degrees of freedom * @return float

1 call to PHPExcel_Calculation_Statistical::CHIDIST()
PHPExcel_Calculation_Statistical::CHIINV in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Statistical.php
* CHIINV * * Returns the one-tailed probability of the chi-squared distribution. * *

File

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

Class

PHPExcel_Calculation_Statistical
PHPExcel_Calculation_Statistical

Code

public static function CHIDIST($value, $degrees) {
  $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
  $degrees = floor(PHPExcel_Calculation_Functions::flattenSingleValue($degrees));
  if (is_numeric($value) && is_numeric($degrees)) {
    if ($degrees < 1) {
      return PHPExcel_Calculation_Functions::NaN();
    }
    if ($value < 0) {
      if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) {
        return 1;
      }
      return PHPExcel_Calculation_Functions::NaN();
    }
    return 1 - self::_incompleteGamma($degrees / 2, $value / 2) / self::_gamma($degrees / 2);
  }
  return PHPExcel_Calculation_Functions::VALUE();
}