Click or drag to resize
Accord.NET (logo)

LognormalDistribution Class

Log-Normal (Galton) distribution.
Inheritance Hierarchy
SystemObject
  Accord.Statistics.DistributionsDistributionBase
    Accord.Statistics.Distributions.UnivariateUnivariateContinuousDistribution
      Accord.Statistics.Distributions.UnivariateLognormalDistribution

Namespace:  Accord.Statistics.Distributions.Univariate
Assembly:  Accord.Statistics (in Accord.Statistics.dll) Version: 3.8.0
Syntax
[SerializableAttribute]
public class LognormalDistribution : UnivariateContinuousDistribution, 
	IFittableDistribution<double, NormalOptions>, IFittable<double, NormalOptions>, 
	IFittable<double>, IFittableDistribution<double>, IDistribution<double>, 
	IDistribution, ICloneable, ISampleableDistribution<double>, IRandomNumberGenerator<double>, 
	IFormattable
Request Example View Source

The LognormalDistribution type exposes the following members.

Constructors
  NameDescription
Public methodLognormalDistribution
Constructs a Log-Normal (Galton) distribution with zero location and unit shape.
Public methodLognormalDistribution(Double)
Constructs a Log-Normal (Galton) distribution with given location and unit shape.
Public methodLognormalDistribution(Double, Double)
Constructs a Log-Normal (Galton) distribution with given mean and standard deviation.
Top
Properties
  NameDescription
Public propertyEntropy
Gets the Entropy for this Log-Normal distribution.
(Overrides UnivariateContinuousDistributionEntropy.)
Public propertyLocation
Location parameter μ (mu) of the log-normal distribution.
Public propertyMean
Gets the Mean for this Log-Normal distribution.
(Overrides UnivariateContinuousDistributionMean.)
Public propertyMedian
Gets the median for this distribution.
(Inherited from UnivariateContinuousDistribution.)
Public propertyMode
Gets the mode for this distribution.
(Overrides UnivariateContinuousDistributionMode.)
Public propertyQuartiles
Gets the Quartiles for this distribution.
(Inherited from UnivariateContinuousDistribution.)
Public propertyShape
Shape parameter σ (sigma) of the log-normal distribution.
Public propertyShape2
Squared shape parameter σ² (sigma-squared) of the log-normal distribution.
Public propertyStatic memberStandard
Gets the Standard Log-Normal Distribution, with location set to zero and unit shape.
Public propertyStandardDeviation
Gets the Standard Deviation (the square root of the variance) for the current distribution.
(Inherited from UnivariateContinuousDistribution.)
Public propertySupport
Gets the support interval for this distribution.
(Overrides UnivariateContinuousDistributionSupport.)
Public propertyVariance
Gets the Variance (the square of the standard deviation) for this Log-Normal distribution.
(Overrides UnivariateContinuousDistributionVariance.)
Top
Methods
  NameDescription
Public methodClone
Creates a new object that is a copy of the current instance.
(Overrides DistributionBaseClone.)
Public methodComplementaryDistributionFunction
Gets the complementary cumulative distribution function (ccdf) for this distribution evaluated at point x. This function is also known as the Survival function.
(Inherited from UnivariateContinuousDistribution.)
Public methodCumulativeHazardFunction
Gets the cumulative hazard function for this distribution evaluated at point x.
(Inherited from UnivariateContinuousDistribution.)
Public methodDistributionFunction(Double)
Gets the cumulative distribution function (cdf) for this distribution evaluated at point x.
(Inherited from UnivariateContinuousDistribution.)
Public methodDistributionFunction(Double, Double)
Gets the cumulative distribution function (cdf) for this distribution in the semi-closed interval (a; b] given as P(a < X ≤ b).
(Inherited from UnivariateContinuousDistribution.)
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodStatic memberEstimate(Double)
Estimates a new Log-Normal distribution from a given set of observations.
Public methodStatic memberEstimate(Double, NormalOptions)
Estimates a new Log-Normal distribution from a given set of observations.
Public methodStatic memberEstimate(Double, Double, NormalOptions)
Estimates a new Log-Normal distribution from a given set of observations.
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodCode exampleFit(Double)
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateContinuousDistribution.)
Public methodCode exampleFit(Double, IFittingOptions)
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateContinuousDistribution.)
Public methodCode exampleFit(Double, Double)
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateContinuousDistribution.)
Public methodCode exampleFit(Double, Int32)
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateContinuousDistribution.)
Public methodFit(Double, Double, IFittingOptions)
Fits the underlying distribution to a given set of observations.
(Overrides UnivariateContinuousDistributionFit(Double, Double, IFittingOptions).)
Public methodFit(Double, Double, NormalOptions)
Fits the underlying distribution to a given set of observations.
Public methodCode exampleFit(Double, Int32, IFittingOptions)
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateContinuousDistribution.)
Public methodGenerate
Generates a random observation from the current distribution.
(Inherited from UnivariateContinuousDistribution.)
Public methodGenerate(Random)
Generates a random observation from the current distribution.
(Overrides UnivariateContinuousDistributionGenerate(Random).)
Public methodGenerate(Int32)
Generates a random vector of observations from the current distribution.
(Inherited from UnivariateContinuousDistribution.)
Public methodGenerate(Int32, Double)
Generates a random vector of observations from the current distribution.
(Inherited from UnivariateContinuousDistribution.)
Public methodGenerate(Int32, Random)
Generates a random vector of observations from the current distribution.
(Inherited from UnivariateContinuousDistribution.)
Public methodGenerate(Int32, Double, Random)
Generates a random vector of observations from the current distribution.
(Overrides UnivariateContinuousDistributionGenerate(Int32, Double, Random).)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetRange
Gets the distribution range within a given percentile.
(Inherited from UnivariateContinuousDistribution.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodHazardFunction
Gets the hazard function, also known as the failure rate or the conditional failure density function for this distribution evaluated at point x.
(Inherited from UnivariateContinuousDistribution.)
Protected methodInnerComplementaryDistributionFunction
Gets the complementary cumulative distribution function (ccdf) for this distribution evaluated at point x. This function is also known as the Survival function.
(Inherited from UnivariateContinuousDistribution.)
Protected methodCode exampleInnerDistributionFunction
Gets the cumulative distribution function (cdf) for the this Log-Normal distribution evaluated at point x.
(Overrides UnivariateContinuousDistributionInnerDistributionFunction(Double).)
Protected methodInnerInverseDistributionFunction
Gets the inverse of the cumulative distribution function (icdf) for this distribution evaluated at probability p. This function is also known as the Quantile function.
(Inherited from UnivariateContinuousDistribution.)
Protected methodCode exampleInnerLogProbabilityDensityFunction
Gets the log-probability density function (pdf) for this distribution evaluated at point x.
(Overrides UnivariateContinuousDistributionInnerLogProbabilityDensityFunction(Double).)
Protected methodCode exampleInnerProbabilityDensityFunction
Gets the probability density function (pdf) for the Normal distribution evaluated at point x.
(Overrides UnivariateContinuousDistributionInnerProbabilityDensityFunction(Double).)
Public methodInverseDistributionFunction
Gets the inverse of the cumulative distribution function (icdf) for this distribution evaluated at probability p. This function is also known as the Quantile function.
(Inherited from UnivariateContinuousDistribution.)
Public methodLogCumulativeHazardFunction
Gets the log of the cumulative hazard function for this distribution evaluated at point x.
(Inherited from UnivariateContinuousDistribution.)
Public methodLogProbabilityDensityFunction
Gets the log-probability density function (pdf) for this distribution evaluated at point x.
(Inherited from UnivariateContinuousDistribution.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodProbabilityDensityFunction
Gets the probability density function (pdf) for this distribution evaluated at point x.
(Inherited from UnivariateContinuousDistribution.)
Public methodQuantileDensityFunction
Gets the first derivative of the inverse distribution function (icdf) for this distribution evaluated at probability p.
(Inherited from UnivariateContinuousDistribution.)
Public methodStatic memberRandom(Double, Double)
Generates a random observation from the Lognormal distribution with the given parameters.
Public methodStatic memberRandom(Double, Double, Int32)
Generates a random vector of observations from the Lognormal distribution with the given parameters.
Public methodStatic memberRandom(Double, Double, Random)
Generates a random observation from the Lognormal distribution with the given parameters.
Public methodStatic memberRandom(Double, Double, Int32, Double)
Generates a random vector of observations from the Lognormal distribution with the given parameters.
Public methodStatic memberRandom(Double, Double, Int32, Random)
Generates a random vector of observations from the Lognormal distribution with the given parameters.
Public methodStatic memberRandom(Double, Double, Int32, Double, Random)
Generates a random vector of observations from the Lognormal distribution with the given parameters.
Public methodToString
Returns a String that represents this instance.
(Inherited from DistributionBase.)
Public methodToString(IFormatProvider)
Returns a String that represents this instance.
(Inherited from DistributionBase.)
Public methodToString(String)
Returns a String that represents this instance.
(Inherited from DistributionBase.)
Public methodToString(String, IFormatProvider)
Returns a String that represents this instance.
(Overrides DistributionBaseToString(String, IFormatProvider).)
Top
Extension Methods
  NameDescription
Public Extension MethodHasMethod
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.)
Public Extension MethodIsEqual
Compares two objects for equality, performing an elementwise comparison if the elements are vectors or matrices.
(Defined by Matrix.)
Public Extension MethodTo(Type)Overloaded.
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)
Public Extension MethodToTOverloaded.
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)
Top
Remarks

The log-normal distribution is a probability distribution of a random variable whose logarithm is normally distributed.

References:

  • Wikipedia, The Free Encyclopedia. Log-normal distribution. Available on: http://en.wikipedia.org/wiki/Log-normal_distribution
  • NIST/SEMATECH e-Handbook of Statistical Methods. Lognormal Distribution. Available on: http://www.itl.nist.gov/div898/handbook/eda/section3/eda3669.htm
  • Weisstein, Eric W. "Normal Distribution Function." From MathWorld--A Wolfram Web Resource. http://mathworld.wolfram.com/NormalDistributionFunction.html

Examples
// Create a new Log-normal distribution with μ = 2.79 and σ = 1.10
var log = new LognormalDistribution(location: 0.42, shape: 1.1);

// Common measures
double mean = log.Mean;     // 2.7870954605658511
double median = log.Median; // 1.5219615583481305
double var = log.Variance;  // 18.28163603621158

// Cumulative distribution functions
double cdf = log.DistributionFunction(x: 0.27);           // 0.057961222885664958
double ccdf = log.ComplementaryDistributionFunction(x: 0.27); // 0.942038777114335
double icdf = log.InverseDistributionFunction(p: cdf);        // 0.26999997937815973

// Probability density functions
double pdf = log.ProbabilityDensityFunction(x: 0.27);     // 0.39035530085982068
double lpdf = log.LogProbabilityDensityFunction(x: 0.27); // -0.94069792674674835

// Hazard (failure rate) functions
double hf = log.HazardFunction(x: 0.27);            // 0.41437285846720867
double chf = log.CumulativeHazardFunction(x: 0.27); // 0.059708840588116374

// String representation
string str = log.ToString("N2", CultureInfo.InvariantCulture); // Lognormal(x; μ = 2.79, σ = 1.10)
See Also