ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Weibull.php
Go to the documentation of this file.
1 <?php
2 
4 
7 
8 class Weibull
9 {
23  public static function distribution($value, $alpha, $beta, $cumulative)
24  {
25  $value = Functions::flattenSingleValue($value);
26  $alpha = Functions::flattenSingleValue($alpha);
27  $beta = Functions::flattenSingleValue($beta);
28  $cumulative = Functions::flattenSingleValue($cumulative);
29 
30  try {
34  $cumulative = DistributionValidations::validateBool($cumulative);
35  } catch (Exception $e) {
36  return $e->getMessage();
37  }
38 
39  if (($value < 0) || ($alpha <= 0) || ($beta <= 0)) {
40  return Functions::NAN();
41  }
42 
43  if ($cumulative) {
44  return 1 - exp(0 - ($value / $beta) ** $alpha);
45  }
46 
47  return ($alpha / $beta ** $alpha) * $value ** ($alpha - 1) * exp(0 - ($value / $beta) ** $alpha);
48  }
49 }
static flattenSingleValue($value='')
Convert an array to a single scalar value by extracting the first element.
Definition: Functions.php:649
static distribution($value, $alpha, $beta, $cumulative)
WEIBULL.
Definition: Weibull.php:23