mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-17 08:58:41 +00:00
fix cdf function + add icdf
This commit is contained in:
parent
ab023cad8b
commit
61c9bacb80
|
|
@ -101,7 +101,13 @@ final class NormalDistribution
|
|||
*/
|
||||
public static function getCdf(float $x, float $mu, float $sig) : float
|
||||
{
|
||||
return 1 / 2 * (1 + Functions::getErf(($x - $mu) / ($sig * \sqrt(2))));
|
||||
return 0.5 * Functions::getErf(-($x - $mu) / ($sig * \sqrt(2)));
|
||||
}
|
||||
|
||||
// AKA Quantile function and sometimes PPF
|
||||
public static function getICdf(float $x, float $mu, float $sig) : float
|
||||
{
|
||||
return $mu - $sig * \sqrt(2) * Functions::getInvErfc(2 * $x);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user