IGLib  1.7.2
The IGLib base library EXTENDED - with other lilbraries and applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
Meta.Numerics.Statistics.Distributions.LognormalDistribution Class Reference

Represents a log-normal distribution. More...

+ Inheritance diagram for Meta.Numerics.Statistics.Distributions.LognormalDistribution:
+ Collaboration diagram for Meta.Numerics.Statistics.Distributions.LognormalDistribution:

Public Member Functions

 LognormalDistribution (double mu, double sigma)
 Initializes a log-normal distribution. More...
 
 LognormalDistribution ()
 Initializes a standard log-normal distribution. More...
 
override double ProbabilityDensity (double x)
 Returns the probability density at the given point.
Parameters
xThe reference point.
Returns
The probability density p(x).
The probability density function (PDF) gives the relative probability of obtaining different values. More...
 
override double LeftProbability (double x)
 Returns the cumulative probability to the left of (below) the given point.
Parameters
xThe reference point.
Returns
The integrated probability to obtain a result below the reference point.
The left probability function is commonly called the cumulative distribution function (CDF). More...
 
override double RightProbability (double x)
 Return the cumulative probability to the right of (above) the given point.
Parameters
xThe reference point.
Returns
The integrated probability 1-P(x1) to obtain a result above the reference point.
In survival analysis, the right probability function is commonly called the survival function, because it gives the fraction of the population remaining after the given time. More...
 
override double InverseLeftProbability (double P)
 Returns the point at which the cumulative distribution function attains a given value.
Parameters
PThe left cumulative probability P, which must lie between 0 and 1.
Returns
The value x at which LeftProbability equals P.
The inverse left probability is commonly called the quantile function. Given a quantile, it tells which variable value is the lower border of that quantile. More...
 
override double InverseRightProbability (double Q)
 Returns the point at which the right probability function attains the given value.
Parameters
QThe right cumulative probability, which must lie between 0 and 1.
Returns
The value x for which RightProbability equals Q.
More...
 
override double GetRandomValue (Random rng)
 Returns a random value.
Parameters
rngA random number generator.
Returns
A number distributed according to the distribution.
Note that the random number generator rng will be advanced by this method. The next call to its generator methods will not give the same value as it would had it not been passed to this method. More...
 
override double Moment (int n)
 Computes a raw moment of the distribution.
Parameters
rThe order of the moment to compute.
Returns
The rth raw moment of the distribution.
See also
Moment
More...
 
override double MomentAboutMean (int n)
 Computes a central moment of the distribution.
Parameters
rThe order of the moment to compute.
Returns
The rth central moment of the distribution.
See also
Moment
More...
 
- Public Member Functions inherited from Meta.Numerics.Statistics.Distributions.Distribution
virtual double ExpectationValue (Func< double, double > f)
 Computes the expectation value of the given function. More...
 
- Public Member Functions inherited from Meta.Numerics.Statistics.Distributions.UnivariateDistribution
virtual double Cumulant (int r)
 Computes a cumulant of the distribution. More...
 

Static Public Member Functions

static FitResult FitToSample (Sample sample)
 Computes the log-normal distribution that best fits the given sample. More...
 

Properties

double Mu [get]
 Gets the value of the &#x3BC; parameter. More...
 
double Sigma [get]
 Gets the value of the &#x3C3; parameter. More...
 
override double Mean [get]
 
override double Median [get]
 
override double Variance [get]
 
override double Skewness [get]
 
override double ExcessKurtosis [get]
 
override Interval Support [get]
 
- Properties inherited from Meta.Numerics.Statistics.Distributions.Distribution
virtual double Median [get]
 Gets the median of the distribution. More...
 
virtual Interval Support [get]
 Gets the interval over which the distribution is nonvanishing. More...
 
- Properties inherited from Meta.Numerics.Statistics.Distributions.UnivariateDistribution
virtual double Mean [get]
 Gets the mean of the distribution. More...
 
virtual double Variance [get]
 Gets the variance of the distribution. More...
 
virtual double StandardDeviation [get]
 Gets the standard deviation of the distribution. More...
 
virtual double Skewness [get]
 Gets the skewness of the distribution. More...
 
virtual double ExcessKurtosis [get]
 Gets the excess kurtosis of the distribution. More...
 

Private Member Functions

double[]
IParameterizedDistribution. 
GetParameters ()
 Gets the parameter values of the distribution. More...
 
void IParameterizedDistribution. SetParameters (IList< double > parameters)
 Sets the parameter values of the distribution. More...
 
double IParameterizedDistribution. Likelihood (double x)
 Gets the likelihood of a value, given the current parameters. More...
 

Private Attributes

double mu = 0.0
 
double sigma = 1.0
 
NormalDistribution normal
 

Detailed Description

Represents a log-normal distribution.

The logrithm of a log-normal distributed variable is distributed normally.

The log-normal distribution is commonly used in financial engineering as a model of stock prices. If the rate of return on an asset is distributed normally, then its price will be distributed log-normally.

See also
NormalDistribution

Constructor & Destructor Documentation

Meta.Numerics.Statistics.Distributions.LognormalDistribution.LognormalDistribution ( double  mu,
double  sigma 
)
inline

Initializes a log-normal distribution.

Parameters
muThe mean of the underlying normal distribution.
sigmaThe standard deviation of the underlying normal distribution.

Note that the values of &#x3BC; and &#x3C3; parameters are not the mean and standard deviation of the log-normal distribution. They are the mean and standard deviation of their logrithms z = ln x. This is the standard method of characterizing a log-normal distribution.

Meta.Numerics.Statistics.Distributions.LognormalDistribution.LognormalDistribution ( )
inline

Initializes a standard log-normal distribution.

A standard log-normal distribution has &#x3BC; = 0 and &#x3C3; = 1. It is the log transform of the standard normal distribution.

Member Function Documentation

override double Meta.Numerics.Statistics.Distributions.LognormalDistribution.ProbabilityDensity ( double  x)
inlinevirtual

Returns the probability density at the given point.

Parameters
xThe reference point.
Returns
The probability density p(x).
The probability density function (PDF) gives the relative probability of obtaining different values.

Implements Meta.Numerics.Statistics.Distributions.Distribution.

override double Meta.Numerics.Statistics.Distributions.LognormalDistribution.LeftProbability ( double  x)
inlinevirtual

Returns the cumulative probability to the left of (below) the given point.

Parameters
xThe reference point.
Returns
The integrated probability to obtain a result below the reference point.
The left probability function is commonly called the cumulative distribution function (CDF).

Reimplemented from Meta.Numerics.Statistics.Distributions.Distribution.

References Meta.Numerics.Statistics.Distributions.NormalDistribution.LeftProbability().

override double Meta.Numerics.Statistics.Distributions.LognormalDistribution.RightProbability ( double  x)
inlinevirtual

Return the cumulative probability to the right of (above) the given point.

Parameters
xThe reference point.
Returns
The integrated probability 1-P(x1) to obtain a result above the reference point.
In survival analysis, the right probability function is commonly called the survival function, because it gives the fraction of the population remaining after the given time.

Reimplemented from Meta.Numerics.Statistics.Distributions.Distribution.

References Meta.Numerics.Statistics.Distributions.NormalDistribution.RightProbability().

override double Meta.Numerics.Statistics.Distributions.LognormalDistribution.InverseLeftProbability ( double  P)
inlinevirtual

Returns the point at which the cumulative distribution function attains a given value.

Parameters
PThe left cumulative probability P, which must lie between 0 and 1.
Returns
The value x at which LeftProbability equals P.
The inverse left probability is commonly called the quantile function. Given a quantile, it tells which variable value is the lower border of that quantile.

Reimplemented from Meta.Numerics.Statistics.Distributions.Distribution.

References Meta.Numerics.Statistics.Distributions.NormalDistribution.InverseLeftProbability().

override double Meta.Numerics.Statistics.Distributions.LognormalDistribution.InverseRightProbability ( double  Q)
inlinevirtual

Returns the point at which the right probability function attains the given value.

Parameters
QThe right cumulative probability, which must lie between 0 and 1.
Returns
The value x for which RightProbability equals Q.

Reimplemented from Meta.Numerics.Statistics.Distributions.Distribution.

References Meta.Numerics.Statistics.Distributions.NormalDistribution.InverseRightProbability().

override double Meta.Numerics.Statistics.Distributions.LognormalDistribution.GetRandomValue ( Random  rng)
inlinevirtual

Returns a random value.

Parameters
rngA random number generator.
Returns
A number distributed according to the distribution.
Note that the random number generator rng will be advanced by this method. The next call to its generator methods will not give the same value as it would had it not been passed to this method.

Reimplemented from Meta.Numerics.Statistics.Distributions.Distribution.

References Meta.Numerics.Statistics.Distributions.NormalDistribution.GetRandomValue().

override double Meta.Numerics.Statistics.Distributions.LognormalDistribution.Moment ( int  n)
inlinevirtual

Computes a raw moment of the distribution.

Parameters
rThe order of the moment to compute.
Returns
The rth raw moment of the distribution.
See also
Moment

Reimplemented from Meta.Numerics.Statistics.Distributions.Distribution.

References Meta.Numerics.MoreMath.Sqr().

override double Meta.Numerics.Statistics.Distributions.LognormalDistribution.MomentAboutMean ( int  n)
inlinevirtual

Computes a central moment of the distribution.

Parameters
rThe order of the moment to compute.
Returns
The rth central moment of the distribution.
See also
Moment

Reimplemented from Meta.Numerics.Statistics.Distributions.Distribution.

References Meta.Numerics.Functions.AdvancedIntegerMath.BinomialCoefficient(), and Meta.Numerics.MoreMath.Sqr().

static FitResult Meta.Numerics.Statistics.Distributions.LognormalDistribution.FitToSample ( Sample  sample)
inlinestatic

Computes the log-normal distribution that best fits the given sample.

Parameters
sampleThe sample to fit.
Returns
The best fit parameters.

The returned fit parameters are the &#x3BC; (Mu) and &#x3C3; (Sigma) parameters, in that order. These are the same parameters, in the same order, that are required by the LognormalDistribution(double,double) constructor to specify a new log-normal distribution.

Exceptions
ArgumentNullExceptionsample is null.
InsufficientDataExceptionsample contains fewer than three values.
InvalidOperationExceptionsample contains non-positive values.

References Meta.Numerics.Statistics.Sample.Count.

Referenced by Test.SampleTest.LognormalFit().

double [] IParameterizedDistribution. Meta.Numerics.Statistics.Distributions.LognormalDistribution.GetParameters ( )
inlineprivate

Gets the parameter values of the distribution.

Returns
The parameter values characterizing the distribution.

Implements Meta.Numerics.Statistics.Distributions.IParameterizedDistribution.

void IParameterizedDistribution. Meta.Numerics.Statistics.Distributions.LognormalDistribution.SetParameters ( IList< double >  parameters)
inlineprivate

Sets the parameter values of the distribution.

Parameters
parametersA list of parameter values.

Implements Meta.Numerics.Statistics.Distributions.IParameterizedDistribution.

double IParameterizedDistribution. Meta.Numerics.Statistics.Distributions.LognormalDistribution.Likelihood ( double  x)
inlineprivate

Gets the likelihood of a value, given the current parameters.

Parameters
xThe value.
Returns
The likelihood of the value.

Implements Meta.Numerics.Statistics.Distributions.IParameterizedDistribution.

Member Data Documentation

double Meta.Numerics.Statistics.Distributions.LognormalDistribution.mu = 0.0
private
double Meta.Numerics.Statistics.Distributions.LognormalDistribution.sigma = 1.0
private
NormalDistribution Meta.Numerics.Statistics.Distributions.LognormalDistribution.normal
private

Property Documentation

double Meta.Numerics.Statistics.Distributions.LognormalDistribution.Mu
get

Gets the value of the &#x3BC; parameter.

Note that the value of this parameter is not the mean of the distribution. It is the value given to the distribution constructor (LognormalDistribution(double,double)), which is the mean of the underlying normal distribution.

Referenced by Test.SampleTest.LognormalFit().

double Meta.Numerics.Statistics.Distributions.LognormalDistribution.Sigma
get

Gets the value of the &#x3C3; parameter.

Note that the value of this parameter is not the standard deviation of the distribution. It is the value given to the distribution constructor (LognormalDistribution(double,double)), which is the sandard deviation of the underlying normal distribution.

Referenced by Test.SampleTest.LognormalFit().

override double Meta.Numerics.Statistics.Distributions.LognormalDistribution.Mean
get

override double Meta.Numerics.Statistics.Distributions.LognormalDistribution.Median
get

override double Meta.Numerics.Statistics.Distributions.LognormalDistribution.Variance
get

override double Meta.Numerics.Statistics.Distributions.LognormalDistribution.Skewness
get

override double Meta.Numerics.Statistics.Distributions.LognormalDistribution.ExcessKurtosis
get

override Interval Meta.Numerics.Statistics.Distributions.LognormalDistribution.Support
get


The documentation for this class was generated from the following file: