You are here

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

* BETADIST * * Returns the beta distribution. * *

Parameters

float $value Value at which you want to evaluate the distribution: * @param float $alpha Parameter to the distribution * @param float $beta Parameter to the distribution * @param boolean $cumulative * @return float *

1 call to PHPExcel_Calculation_Statistical::BETADIST()
PHPExcel_Calculation_Statistical::BETAINV in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Statistical.php
* BETAINV * * Returns the inverse of the beta distribution. * *

File

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

Class

PHPExcel_Calculation_Statistical
PHPExcel_Calculation_Statistical

Code

public static function BETADIST($value, $alpha, $beta, $rMin = 0, $rMax = 1) {
  $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
  $alpha = PHPExcel_Calculation_Functions::flattenSingleValue($alpha);
  $beta = PHPExcel_Calculation_Functions::flattenSingleValue($beta);
  $rMin = PHPExcel_Calculation_Functions::flattenSingleValue($rMin);
  $rMax = PHPExcel_Calculation_Functions::flattenSingleValue($rMax);
  if (is_numeric($value) && is_numeric($alpha) && is_numeric($beta) && is_numeric($rMin) && is_numeric($rMax)) {
    if ($value < $rMin || $value > $rMax || $alpha <= 0 || $beta <= 0 || $rMin == $rMax) {
      return PHPExcel_Calculation_Functions::NaN();
    }
    if ($rMin > $rMax) {
      $tmp = $rMin;
      $rMin = $rMax;
      $rMax = $tmp;
    }
    $value -= $rMin;
    $value /= $rMax - $rMin;
    return self::_incompleteBeta($value, $alpha, $beta);
  }
  return PHPExcel_Calculation_Functions::VALUE();
}