lognormalInverseCdf¶
Evaluates the inverse of the lognormal cumulative distribution function (CDF).
Synopsis¶
lognormalInverseCdf(p, amu, sigma)
Required Arguments¶
- float
p
(Input) - Probability for which the inverse of the lognormal CDF is to be
evaluated.
p
must lie in the closed interval [0, 1]. - float
amu
(Input) - Location parameter of the lognormal CDF.
- float
sigma
(Input) - Shape parameter of the lognormal CDF.
sigma
must be positive.
Return Value¶
Function value, the probability that a lognormal random variable takes a
value less than or equal to the returned value is the input probability
p
. A value of NaN is returned if an input value is in error.
Description¶
The function lognormalInverseCdf
evaluates the inverse CDF of a
lognormal random variable with location parameter amu
and scale
parameter sigma
. The probability that a standard lognormal random
variable takes a value less than or equal to the returned value is p
(p
=P
).
\[P = \frac{1}{\sigma\sqrt{2\pi}} \int_0^x
\frac{e^{-\frac{1}{2}\left(\frac{\log(t)-\mu}{\sigma}\right)^2}}{t} dt =
\varphi \left(\frac{\log(x) = \mu}{\sigma}\right)\]
where
\[\varphi(y) = \frac{1}{\sqrt{2\pi}} \int_{-\infty}^{y}
e^{-\frac{1}{2} u^2} du\]
In other words
\[F^{-1} = (P|\mu,\sigma) = x\]
Example¶
In this example, we evaluate the inverse CDF at p
= 0.25, amu
= 0.0,
sigma
= 0.5.
from __future__ import print_function
from numpy import *
from pyimsl.stat.lognormalInverseCdf import lognormalInverseCdf
p = 0.25
amu = 0.0
sigma = 0.5
x = lognormalInverseCdf(p, 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 %4.2f" % (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.25