pystra.distributions.lognormal.Lognormal#

class Lognormal(name, mean, stdv, input_type=None, startpoint=None)[source]#

Bases: Distribution

Lognormal distribution

Arguments:
  • name (str): Name of the random variable

  • mean (float): Mean or lamb

  • stdv (float): Standard deviation or zeta

  • input_type (any): Change meaning of mean and stdv

  • startpoint (float): Start point for seach

Note: Could use scipy to do the heavy lifting. However, there is a small performance hit, so for this common dist use bespoke implementation for the PDF, CDF.

Methods

cdf

Cumulative distribution function

getMean

getName

getStartPoint

getStdv

jacobian

Compute the Jacobian

pdf

Probability density function Note: asssumes x>0 for performance, scipy manages this appropriately

plot

Plots the PDF of the distribution

ppf

Inverse cumulative distribution function

sample

Return a sample of the distribution of length n

setStartPoint

set_location

Updating the distribution location parameter.

set_scale

Updating the distribution scale parameter.

u_to_x

Transformation from u to x

x_to_u

Transformation from x to u Note: asssumes x>0 for performance

Attributes

std_normal

pdf(x)[source]#

Probability density function Note: asssumes x>0 for performance, scipy manages this appropriately

cdf(x)[source]#

Cumulative distribution function

u_to_x(u)[source]#

Transformation from u to x

x_to_u(x)[source]#

Transformation from x to u Note: asssumes x>0 for performance

set_location(loc=0)[source]#

Updating the distribution location parameter. For Lognormal, even though we have a SciPy object, it’s not being used in the functions above for performance, so we need to update pe.arams directly.

set_scale(scale=1)[source]#

Updating the distribution scale parameter. For Lognormal, even though we have a SciPy object, it’s not being used in the functions above for performance, so we need to update params directly.

jacobian(u, x)#

Compute the Jacobian

plot(ax=None, **kwargs)#

Plots the PDF of the distribution

ppf(u)#

Inverse cumulative distribution function

sample(n=1000)#

Return a sample of the distribution of length n