Chi-square

Function for generating values from chi-square distributions.

Interface

chisq(n:int) : real

where n>=1. It returns a drawing from a chi-square distribution with n degrees of freedom.

The sum of the squares of n independent normally distributed random variables with mean 0.0 and standard deviation 1.0 is a chi-squared distribution with n degrees of freedom.

It raises Chisq exception if n<1.

Characteristics

Mean: n
Variance: 2n

Density functions for chi-square distributions:

Density functions for chi-square distributions

Example

An example for this distribution has been omitted because it is rarely found in nature. Instead, the distribution is used when doing statistical tests.

Related pages