lognormalPdf

Evaluates the lognormal probability density function (PDF).

Synopsis

lognormalPdf(x, amu, sigma)

Required Arguments

float x (Input)
Argument for which the lognormal PDF is to be evaluated. x must be non-negative.
float amu (Input)
Location parameter of the lognormal PDF.
float sigma (Input)
Shape parameter of the lognormal PDF. sigma must be positive.

Return Value

The probability density of a lognormally distributed random variable with value x, location parameter amu, and shape parameter sigma. A value of NaN is returned if an input value is in error.

Description

The function lognormalPdf evaluates the lognormal probability density function (PDF), defined as

\[f(x|\mu,\sigma) = \frac{1}{x \sigma \sqrt{2\pi}} e^{-\frac{[\log(x)\mu]^2}{2\sigma^2}}\]

Example

In this example, we evaluate the PDF at x = 1.0, amu = 0.0, sigma = 0.5.

from __future__ import print_function
from numpy import *
from pyimsl.stat.lognormalPdf import lognormalPdf

x = 1.0
amu = 0.0
sigma = 0.5

pdfv = lognormalPdf(x, amu, sigma)
print("The probability density of lognormal random variable X")
print("with location parameter amu = %3.1f, " % amu)
print("shape parameter sigma = %3.1f, " % sigma)
print("and value x = %3.1f is %6.4f" % (x, pdfv))

Output

The probability density of lognormal random variable X
with location parameter amu = 0.0, 
shape parameter sigma = 0.5, 
and value x = 1.0 is 0.7979