IGLib
1.7.2
The IGLib base library EXTENDED - with other lilbraries and applications.
|
Represents a normal (Gaussian) distribution. More...
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.
| |||
override double | LeftProbability (double x) | ||
Returns the cumulative probability to the left of (below) the given point.
| |||
override double | RightProbability (double x) | ||
Return the cumulative probability to the right of (above) the given point.
| |||
override double | Moment (int r) | ||
Computes a raw moment of the distribution.
| |||
override double | MomentAboutMean (int r) | ||
Computes a central moment of the distribution.
| |||
override double | Cumulant (int r) | ||
Computes a cumulant of the distribution.
| |||
override double | InverseLeftProbability (double P) | ||
Returns the point at which the cumulative distribution function attains a given value.
| |||
override double | InverseRightProbability (double Q) | ||
Returns the point at which the right probability function attains the given value.
| |||
override double | GetRandomValue (Random rng) | ||
Returns a random value.
| |||
![]() | |||
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] |
![]() | |
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... | |
![]() | |
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 |
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 - μ) / σ.
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.
|
inline |
Initializes a new normal distribution with the given mean and standard deviation.
mu | The mean. |
sigma | The standard deviation, which must be positive. |
ArgumentOutOfRangeException | sigma is less than or equal to zero. |
|
inline |
Initializes a new standard normal distribution.
The standard normal distribution has mean zero and standard deviation one.
|
inlinevirtual |
Returns the probability density at the given point.
x | The reference point. |
Implements Meta.Numerics.Statistics.Distributions.Distribution.
|
inlinevirtual |
Returns the cumulative probability to the left of (below) the given point.
x | The reference point. |
Reimplemented from Meta.Numerics.Statistics.Distributions.Distribution.
Referenced by Meta.Numerics.Statistics.Distributions.LognormalDistribution.LeftProbability().
|
inlinevirtual |
Return the cumulative probability to the right of (above) the given point.
x | The reference point. |
Reimplemented from Meta.Numerics.Statistics.Distributions.Distribution.
Referenced by Meta.Numerics.Statistics.Distributions.LognormalDistribution.RightProbability().
|
inlinevirtual |
Computes a raw moment of the distribution.
r | The order of the moment to compute. |
Reimplemented from Meta.Numerics.Statistics.Distributions.Distribution.
References Meta.Numerics.Statistics.Distributions.MomentMath.CentralToRaw().
|
inlinevirtual |
Computes a central moment of the distribution.
r | The order of the moment to compute. |
Reimplemented from Meta.Numerics.Statistics.Distributions.Distribution.
References Meta.Numerics.Functions.AdvancedIntegerMath.DoubleFactorial(), and Meta.Numerics.MoreMath.Pow().
|
inlinevirtual |
Computes a cumulant of the distribution.
r | The index of the cumulant to compute. |
Reimplemented from Meta.Numerics.Statistics.Distributions.UnivariateDistribution.
|
inlinevirtual |
Returns the point at which the cumulative distribution function attains a given value.
P | The left cumulative probability P, which must lie between 0 and 1. |
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().
|
inlinevirtual |
Returns the point at which the right probability function attains the given value.
Q | The right cumulative probability, which must lie between 0 and 1. |
Reimplemented from Meta.Numerics.Statistics.Distributions.Distribution.
Referenced by Meta.Numerics.Statistics.Distributions.LognormalDistribution.InverseRightProbability(), and FutureTest.FutureTest.TestNormal().
|
inlinevirtual |
Returns a random value.
rng | A random number generator. |
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().
|
inlineprivate |
Gets the parameter values of the distribution.
Implements Meta.Numerics.Statistics.Distributions.IParameterizedDistribution.
|
inlineprivate |
Sets the parameter values of the distribution.
parameters | A list of parameter values. |
Implements Meta.Numerics.Statistics.Distributions.IParameterizedDistribution.
|
inlineprivate |
Gets the likelihood of a value, given the current parameters.
x | The value. |
Implements Meta.Numerics.Statistics.Distributions.IParameterizedDistribution.
|
inlinestatic |
Computes the normal distribution that best fits the given sample.
sample | The sample to fit. |
The returned fit parameters are the μ (Mean) and σ (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.
ArgumentNullException | sample is null. |
InsufficientDataException | sample 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().
|
private |
|
private |
|
private |
|
get |
Referenced by Test.SampleTest.NormalFitUncertainties().
|
get |
Referenced by Test.SampleTest.NormalFitUncertainties().
|
get |
|
get |
|
get |