diff --git a/Math/Stochastic/Distribution/NormalDistribution.php b/Math/Stochastic/Distribution/NormalDistribution.php index eee1a2d89..7cfabb853 100755 --- a/Math/Stochastic/Distribution/NormalDistribution.php +++ b/Math/Stochastic/Distribution/NormalDistribution.php @@ -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); } /**