lognormalCdf¶
Evaluates the lognormal cumulative distribution function (CDF).
Synopsis¶
lognormalCdf(x, amu, sigma)
Required Arguments¶
- float
x
(Input) - Argument for which the lognormal CDF is to be evaluated.
x
must be non-negative. - float
amu
(Input) - Location parameter of the lognormal CDF.
- float
sigma
(Input) - Shape parameter of the lognormal CDF.
sigma
must be positive.
Return Value¶
The probability that a lognormal random variable takes a value less than or
equal to x
. A value of NaN is returned if an input value is in error.
Description¶
The function lognormalCdf
evaluates the lognormal cumulative
distribution function (CDF), defined as
\[F(x|\mu,\sigma) = \frac{1}{\sigma \sqrt{2\pi}}
\int_0^x \frac{1}{t}
e^{-\frac{1}{2}\left(\frac{\log(t)-\mu}{\sigma}\right)^2}
dt = \phi\left(\frac{\log(x) - \mu}{\sigma}\right)\]
where
\[\phi(y) = \frac{1}{\sqrt{2\pi}} \int_{-\infty}^{y} e^{-\frac{1}{2} u^2} du\]
is the standard normal CDF.
Example¶
In this example, we evaluate the CDF at x
= 0.7137, amu
= 0.0,
sigma
= 0.5.
from __future__ import print_function
from numpy import *
from pyimsl.stat.lognormalCdf import lognormalCdf
x = 0.7137
amu = 0.0
sigma = 0.5
p = lognormalCdf(x, amu, sigma)
print("The probability that lognormal random variable X")
print("with location parameter amu = %3.1f " % amu)
print("and shape parameter sigma = %3.1f " % sigma)
print("is less than or equal to %6.4f is %6.4f" % (x, p))
Output¶
The probability that lognormal random variable X
with location parameter amu = 0.0
and shape parameter sigma = 0.5
is less than or equal to 0.7137 is 0.2500