NormalDistribution Class 
Namespace: Accord.Statistics.Distributions.Univariate
[SerializableAttribute] public class NormalDistribution : UnivariateContinuousDistribution, IFittableDistribution<double, NormalOptions>, IFittable<double, NormalOptions>, IFittable<double>, IFittableDistribution<double>, IDistribution<double>, IDistribution, ICloneable, ISampleableDistribution<double>, IRandomNumberGenerator<double>, IFormattable, IUnivariateFittableDistribution, IUnivariateDistribution<double>, IUnivariateDistribution
The NormalDistribution type exposes the following members.
Name  Description  

NormalDistribution 
Constructs a Normal (Gaussian) distribution
with zero mean and unit standard deviation.
 
NormalDistribution(Double) 
Constructs a Normal (Gaussian) distribution
with given mean and unit standard deviation.
 
NormalDistribution(Double, Double) 
Constructs a Normal (Gaussian) distribution
with given mean and standard deviation.

Name  Description  

Entropy 
Gets the Entropy for this Normal distribution.
(Overrides UnivariateContinuousDistributionEntropy.)  
Kurtosis 
Gets the excess kurtosis for this distribution.
In the Normal distribution, this is always 0.
 
Mean 
Gets the Mean value μ (mu) for this Normal distribution.
(Overrides UnivariateContinuousDistributionMean.)  
Median 
Gets the median for this distribution.
(Overrides UnivariateContinuousDistributionMedian.)  
Mode 
Gets the mode for this distribution.
(Overrides UnivariateContinuousDistributionMode.)  
Quartiles 
Gets the Quartiles for this distribution.
(Inherited from UnivariateContinuousDistribution.)  
Skewness 
Gets the skewness for this distribution. In
the Normal distribution, this is always 0.
 
Standard 
Gets the Standard Gaussian Distribution, with zero mean and unit variance.
 
StandardDeviation 
Gets the Standard Deviation σ (sigma), which is the
square root of the variance for this Normal distribution.
(Overrides UnivariateContinuousDistributionStandardDeviation.)  
Support 
Gets the support interval for this distribution.
(Overrides UnivariateContinuousDistributionSupport.)  
Variance 
Gets the Variance σ² (sigmasquared), which is the square
of the standard deviation σ for this Normal distribution.
(Overrides UnivariateContinuousDistributionVariance.) 
Name  Description  

Clone 
Creates a new object that is a copy of the current instance.
(Overrides DistributionBaseClone.)  
ComplementaryDistributionFunction 
Gets the complementary cumulative distribution function
(ccdf) for this distribution evaluated at point x.
This function is also known as the Survival function.
(Overrides UnivariateContinuousDistributionComplementaryDistributionFunction(Double).)  
CumulativeHazardFunction 
Gets the cumulative hazard function for this
distribution evaluated at point x.
(Inherited from UnivariateContinuousDistribution.)  
DistributionFunction(Double) 
Gets the cumulative distribution function (cdf) for
the this Normal distribution evaluated at point x.
(Overrides UnivariateContinuousDistributionDistributionFunction(Double).)  
DistributionFunction(Double, Double) 
Gets the cumulative distribution function (cdf) for this
distribution in the semiclosed interval (a; b] given as
P(a < X ≤ b).
(Inherited from UnivariateContinuousDistribution.)  
Equals  Determines whether the specified object is equal to the current object. (Inherited from Object.)  
Estimate(Double) 
Estimates a new Normal distribution from a given set of observations.
 
Estimate(Double, NormalOptions) 
Estimates a new Normal distribution from a given set of observations.
 
Estimate(Double, Double, NormalOptions) 
Estimates a new Normal distribution from a given set of observations.
 
Finalize  Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)  
Fit(Double) 
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateContinuousDistribution.)  
Fit(Double, IFittingOptions) 
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateContinuousDistribution.)  
Fit(Double, Double) 
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateContinuousDistribution.)  
Fit(Double, Int32) 
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateContinuousDistribution.)  
Fit(Double, Double, IFittingOptions) 
Fits the underlying distribution to a given set of observations.
(Overrides UnivariateContinuousDistributionFit(Double, Double, IFittingOptions).)  
Fit(Double, Double, NormalOptions) 
Fits the underlying distribution to a given set of observations.
 
Fit(Double, Int32, IFittingOptions) 
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateContinuousDistribution.)  
Generate 
Generates a random observation from the current distribution.
(Overrides UnivariateContinuousDistributionGenerate.)  
Generate(Int32) 
Generates a random vector of observations from the current distribution.
(Inherited from UnivariateContinuousDistribution.)  
Generate(Int32, Double) 
Generates a random vector of observations from the current distribution.
(Overrides UnivariateContinuousDistributionGenerate(Int32, Double).)  
GetHashCode  Serves as the default hash function. (Inherited from Object.)  
GetRange 
Gets the distribution range within a given percentile.
(Inherited from UnivariateContinuousDistribution.)  
GetType  Gets the Type of the current instance. (Inherited from Object.)  
HazardFunction 
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.)  
InverseDistributionFunction 
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.
(Overrides UnivariateContinuousDistributionInverseDistributionFunction(Double).)  
LogCumulativeHazardFunction 
Gets the log of the cumulative hazard function for this
distribution evaluated at point x.
(Inherited from UnivariateContinuousDistribution.)  
LogProbabilityDensityFunction 
Gets the probability density function (pdf) for
the Normal distribution evaluated at point x.
(Overrides UnivariateContinuousDistributionLogProbabilityDensityFunction(Double).)  
MemberwiseClone  Creates a shallow copy of the current Object. (Inherited from Object.)  
ProbabilityDensityFunction 
Gets the probability density function (pdf) for
the Normal distribution evaluated at point x.
(Overrides UnivariateContinuousDistributionProbabilityDensityFunction(Double).)  
QuantileDensityFunction 
Gets the first derivative of the
inverse distribution function (icdf) for this distribution evaluated
at probability p.
(Inherited from UnivariateContinuousDistribution.)  
Random 
Generates a random value from a standard Normal
distribution (zero mean and unit standard deviation).
 
Random(Double, Double) 
Generates a single random observation from the
Normal distribution with the given parameters.
 
Random(Int32, Double) 
Generates a random vector of observations from the standard
Normal distribution (zero mean and unit standard deviation).
 
Random(Double, Double, Int32) 
Generates a random vector of observations from the
Normal distribution with the given parameters.
 
Random(Double, Double, Int32, Double) 
Generates a random vector of observations from the
Normal distribution with the given parameters.
 
ToMultivariateDistribution 
Converts this univariate distribution into a
1dimensional multivariate distribution.
 
ToString 
Returns a String that represents this instance.
(Inherited from DistributionBase.)  
ToString(IFormatProvider) 
Returns a String that represents this instance.
(Inherited from DistributionBase.)  
ToString(String) 
Returns a String that represents this instance.
(Inherited from DistributionBase.)  
ToString(String, IFormatProvider) 
Returns a String that represents this instance.
(Overrides DistributionBaseToString(String, IFormatProvider).)  
ZScore 
Gets the ZScore for a given value.

Name  Description  

HasMethod 
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.)  
IsEqual  Compares two objects for equality, performing an elementwise comparison if the elements are vectors or matrices. (Defined by Matrix.)  
ToT  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.)  
ToT  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 Matrix.) 
In probability theory, the normal (or Gaussian) distribution is a very commonly occurring continuous probability distribution—a function that tells the probability that any real observation will fall between any two real limits or real numbers, as the curve approaches zero on either side. Normal distributions are extremely important in statistics and are often used in the natural and social sciences for realvalued random variables whose distributions are not known.
The normal distribution is immensely useful because of the central limit theorem, which states that, under mild conditions, the mean of many random variables independently drawn from the same distribution is distributed approximately normally, irrespective of the form of the original distribution: physical quantities that are expected to be the sum of many independent processes (such as measurement errors) often have a distribution very close to the normal. Moreover, many results and methods (such as propagation of uncertainty and least squares parameter fitting) can be derived analytically in explicit form when the relevant variables are normally distributed.
The Gaussian distribution is sometimes informally called the bell curve. However, many other distributions are bellshaped (such as Cauchy's, Student's, and logistic). The terms Gaussian function and Gaussian bell curve are also ambiguous because they sometimes refer to multiples of the normal distribution that cannot be directly interpreted in terms of probabilities.
The Gaussian is the most widely used distribution for continuous variables. In the case of a single variable, it is governed by two parameters, the mean and the variance.
References:
This examples shows how to create a Normal distribution, compute some of its properties and generate a number of random samples from it.
// Create a normal distribution with mean 2 and sigma 3 var normal = new NormalDistribution(mean: 2, stdDev: 3); // In a normal distribution, the median and // the mode coincide with the mean, so double mean = normal.Mean; // 2 double mode = normal.Mode; // 2 double median = normal.Median; // 2 // The variance is the square of the standard deviation double variance = normal.Variance; // 3² = 9 // Let's check what is the cumulative probability of // a value less than 3 occurring in this distribution: double cdf = normal.DistributionFunction(3); // 0.63055 // Finally, let's generate 1000 samples from this distribution // and check if they have the specified mean and standard devs double[] samples = normal.Generate(1000); double sampleMean = samples.Mean(); // 1.92 double sampleDev = samples.StandardDeviation(); // 3.00
This example further demonstrates how to compute derived measures from a Normal distribution:
var normal = new NormalDistribution(mean: 4, stdDev: 4.2); double mean = normal.Mean; // 4.0 double median = normal.Median; // 4.0 double mode = normal.Mode; // 4.0 double var = normal.Variance; // 17.64 double cdf = normal.DistributionFunction(x: 1.4); // 0.26794249453351904 double pdf = normal.ProbabilityDensityFunction(x: 1.4); // 0.078423391448155175 double lpdf = normal.LogProbabilityDensityFunction(x: 1.4); // 2.5456330358182586 double ccdf = normal.ComplementaryDistributionFunction(x: 1.4); // 0.732057505466481 double icdf = normal.InverseDistributionFunction(p: cdf); // 1.4 double hf = normal.HazardFunction(x: 1.4); // 0.10712736480747137 double chf = normal.CumulativeHazardFunction(x: 1.4); // 0.31189620872601354 string str = normal.ToString(CultureInfo.InvariantCulture); // N(x; μ = 4, σ² = 17.64)