The Chi-squared Distribution

The chi-squared distribution arises in statistics If Y_i are n independent gaussian random variates with unit variance then the sum-of-squares,

X_i = \sum_i Y_i^2

has a chi-squared distribution with n degrees of freedom.

Random: double gsl_ran_chisq (const gsl_rng * r, double nu)
This function returns a random variate from the chi-squared distribution with nu degrees of freedom. The distribution function is,

p(x) dx = {1 \over \Gamma(\nu/2) } (x/2)^{\nu/2 - 1} \exp(-x/2) dx

for x >= 0.

Function: double gsl_ran_chisq_pdf (double x, double nu)
This function computes the probability density p(x) at x for a chi-squared distribution with nu degrees of freedom, using the formula given above.