ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
F.php
Go to the documentation of this file.
1<?php
2
4
7
8class F
9{
25 public static function distribution($value, $u, $v, $cumulative)
26 {
27 $value = Functions::flattenSingleValue($value);
30 $cumulative = Functions::flattenSingleValue($cumulative);
31
32 try {
36 $cumulative = DistributionValidations::validateBool($cumulative);
37 } catch (Exception $e) {
38 return $e->getMessage();
39 }
40
41 if ($value < 0 || $u < 1 || $v < 1) {
42 return Functions::NAN();
43 }
44
45 if ($cumulative) {
46 $adjustedValue = ($u * $value) / ($u * $value + $v);
47
48 return Beta::incompleteBeta($adjustedValue, $u / 2, $v / 2);
49 }
50
51 return (Gamma::gammaValue(($v + $u) / 2) /
52 (Gamma::gammaValue($u / 2) * Gamma::gammaValue($v / 2))) *
53 (($u / $v) ** ($u / 2)) *
54 (($value ** (($u - 2) / 2)) / ((1 + ($u / $v) * $value) ** (($u + $v) / 2)));
55 }
56}
An exception for terminatinating execution or to throw for unit testing.
static flattenSingleValue($value='')
Convert an array to a single scalar value by extracting the first element.
Definition: Functions.php:649
static incompleteBeta(float $x, float $p, float $q)
Incomplete beta function.
Definition: Beta.php:147
static distribution($value, $u, $v, $cumulative)
F.DIST.
Definition: F.php:25