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.NormalDistribution Class Reference

Represents a normal (Gaussian) distribution. More...

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

Public Member Functions

 NormalDistribution (double mu, double sigma)
 Initializes a new normal distribution with the given mean and standard deviation. More...
 
 NormalDistribution ()
 Initializes a new standard 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 Moment (int r)
 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 r)
 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...
 
override double Cumulant (int r)
 Computes a cumulant of the distribution.
Parameters
rThe index of the cumulant to compute.
Returns
The rth cumulant of the distribution.
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...
 
- 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...
 

Static Public Member Functions

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

Properties

override double Mean [get]
 
override double StandardDeviation [get]
 
override double Skewness [get]
 
override double ExcessKurtosis [get]
 
override double Median [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
 
double sigma
 
readonly IDeviateGenerator normalRng
 

Detailed Description

Represents a normal (Gaussian) distribution.

A normal distribution is a bell-shaped curve centered at its mean and falling off symmetrically on each side. It is a two-parameter distribution determined by giving its mean and standard deviation, i.e. its center and width. Its range is the entire real number line, but the tails, i.e. points more than a few standard deviations from the means, fall off extremely rapidly.

A normal distribution with mean zero and standard deviation one is called a standard normal distribution. Any normal distribution can be converted to a standard normal distribution by reparameterzing the data in terms of "standard deviations from the mean", i.e. z = (x - &#x3BC;) / &#x3C3;.

Normal distribution appear in many contexts. In practical work, the normal distribution is often used as a crude model for the distribution of any continuous parameter that tends to cluster near its average, for example human height and weight. In more refined theoretical work, the normal distribution often emerges as a limiting distribution. For example, it can be shown that, if a large number of errors affect a measurement, then for nearly any underlying distribution of error terms, the distribution of total error tends to a normal distribution.

The normal distribution is sometimes called a Gaussian distribtuion, after the mathematician Friedrich Gauss.

Constructor & Destructor Documentation

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

Initializes a new normal distribution with the given mean and standard deviation.

Parameters
muThe mean.
sigmaThe standard deviation, which must be positive.
Exceptions
ArgumentOutOfRangeExceptionsigma is less than or equal to zero.
Meta.Numerics.Statistics.Distributions.NormalDistribution.NormalDistribution ( )
inline

Initializes a new standard normal distribution.

The standard normal distribution has mean zero and standard deviation one.

Member Function Documentation

override double Meta.Numerics.Statistics.Distributions.NormalDistribution.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.NormalDistribution.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.

Referenced by Meta.Numerics.Statistics.Distributions.LognormalDistribution.LeftProbability().

override double Meta.Numerics.Statistics.Distributions.NormalDistribution.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.

Referenced by Meta.Numerics.Statistics.Distributions.LognormalDistribution.RightProbability().

override double Meta.Numerics.Statistics.Distributions.NormalDistribution.Moment ( int  r)
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.Statistics.Distributions.MomentMath.CentralToRaw().

override double Meta.Numerics.Statistics.Distributions.NormalDistribution.MomentAboutMean ( int  r)
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.DoubleFactorial(), and Meta.Numerics.MoreMath.Pow().

override double Meta.Numerics.Statistics.Distributions.NormalDistribution.Cumulant ( int  r)
inlinevirtual

Computes a cumulant of the distribution.

Parameters
rThe index of the cumulant to compute.
Returns
The rth cumulant of the distribution.

Reimplemented from Meta.Numerics.Statistics.Distributions.UnivariateDistribution.

override double Meta.Numerics.Statistics.Distributions.NormalDistribution.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.

Referenced by Test.DataSetTest.CreateDataSet(), Meta.Numerics.Statistics.Distributions.LognormalDistribution.InverseLeftProbability(), FutureTest.FutureTest.TestBeta(), and FutureTest.FutureTest.TestNormal().

override double Meta.Numerics.Statistics.Distributions.NormalDistribution.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.

Referenced by Meta.Numerics.Statistics.Distributions.LognormalDistribution.InverseRightProbability(), and FutureTest.FutureTest.TestNormal().

override double Meta.Numerics.Statistics.Distributions.NormalDistribution.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.

Referenced by Test.BivariateSampleTest.BivariateLinearRegressionGoodnessOfFitDistribution(), Meta.Numerics.Statistics.Distributions.LognormalDistribution.GetRandomValue(), Test.MultivariateSampleTest.MultivariateLinearRegressionNullDistribution(), and FutureTest.FutureTest.TwoSampleKS2().

double [] IParameterizedDistribution. Meta.Numerics.Statistics.Distributions.NormalDistribution.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.NormalDistribution.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.NormalDistribution.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.

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

Computes the 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; (Mean) and &#x3C3; (StandardDeviation) parameters, in that order. These are the same parameters, in the same order, that are required by the NormalDistribution(double,double) constructor to specify a new normal distribution.

Exceptions
ArgumentNullExceptionsample is null.
InsufficientDataExceptionsample contains fewer than three values.

References Meta.Numerics.Statistics.Sample.Count, Meta.Numerics.Statistics.Sample.KolmogorovSmirnovTest(), Meta.Numerics.Statistics.Sample.PopulationMean, Meta.Numerics.Statistics.Sample.PopulationStandardDeviation, Meta.Numerics.UncertainValue.Uncertainty, and Meta.Numerics.UncertainValue.Value.

Referenced by Test.SampleTest.BetaFit(), Test.SampleTest.ExponentialFit(), Test.SampleTest.LognormalFit(), Test.SampleTest.NormalFit(), Test.SampleTest.NormalFitUncertainties(), and Test.SampleTest.SampleFitChiSquaredTest().

Member Data Documentation

double Meta.Numerics.Statistics.Distributions.NormalDistribution.mu
private
double Meta.Numerics.Statistics.Distributions.NormalDistribution.sigma
private
readonly IDeviateGenerator Meta.Numerics.Statistics.Distributions.NormalDistribution.normalRng
private

Property Documentation

override double Meta.Numerics.Statistics.Distributions.NormalDistribution.Mean
get
override double Meta.Numerics.Statistics.Distributions.NormalDistribution.StandardDeviation
get
override double Meta.Numerics.Statistics.Distributions.NormalDistribution.Skewness
get

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

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


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