Chi Distribution

The chi (χ) distribution with n degrees of freedom models the distribution of the square root of the sum of the squares of n independent normal variables. Alternatively, it is the distribution of the norm of a vector of n independent normal variables.

The chi distribution is closely related to the chi square distribution. A the square root of a variable with a chi square distribution has a chi distribution.

Special cases of the chi distribution include the Rayleigh distribution (2 degrees of freedom) and the Maxwell distribution (3 degrees of freedom.

The chi distribution has one parameter: the degrees of freedom. This value is usually an integer, but this is not an absolute requirement. The probability density function (PDF) is:

$$f(x) = \frac{x^{n-1}e^{-x^2/2}}{\Gamma(\frac{1}{2}n)2^{n/2-1}}$$

where n is the degrees of freedom.

The chi distribution is implemented by the ChiDistribution class. It has one constructor which takes the degrees of freedom as its only argument. The following constructs a chi distribution with 10 degrees of freedom:

C#
var chi = new ChiDistribution(10);

The ChiDistribution class has one specific property, DegreesOfFreedom, that returns the degrees of freedom of the distribution.

ChiDistribution has one static (Shared in Visual Basic) method, Sample, which generates a random sample using a user-supplied uniform random number generator.

C#
var random = new Pcg32();
double sample = ChiDistribution.Sample(random, 10);

The above example uses the MersenneTwister to generate uniform random numbers.

For details of the properties and methods common to all continuous distribution classes, see the topic on continuous distributions..

See Also