/** * Log normal distribution - cumulative distribution function * * https://en.wikipedia.org/wiki/Log-normal_distribution * * 1 1 / ln x - μ \ * cdf = - + - erf | -------- | * 2 2 \ √2σ / * * @param number $x > 0 * @param number $μ location parameter * @param number $σ scale parameter > 0 * @return number */ public static function CDF($x, $μ, $σ) { Support::checkLimits(self::LIMITS, ['x' => $x, 'μ' => $μ, 'σ' => $σ]); $π = \M_PI; $⟮ln x − μ⟯ = log($x) - $μ; $√2σ = sqrt(2) * $σ; return 1 / 2 + 1 / 2 * Special::erf($⟮ln x − μ⟯ / $√2σ); }
/** * Cumulative distribution function * Probability of being below X. * Area under the normal distribution from -∞ to X. * _ _ * 1 | / x - μ \ | * cdf(x) = - | 1 + erf| ----- | | * 2 |_ \ σ√2 / _| * * @param number $x upper bound * @param number $μ mean * @param number $σ standard deviation * * @return float cdf(x) below */ public static function CDF($x, $μ, $σ) : float { Support::checkLimits(self::LIMITS, ['x' => $x, 'μ' => $μ, 'σ' => $σ]); return 1 / 2 * (1 + Special::erf(($x - $μ) / ($σ * sqrt(2)))); }