# 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.

gsl_ran_chisq(nu)

This function returns a random variate from chi-squared distribution with nu degrees of freedom. The distribution function is,

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

for $$x \geq 0$$.

gsl_ran_chisq_pdf(x, 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.

gsl_ran_chisq_P(x, nu)
gsl_ran_chisq_Q(x, nu)
gsl_ran_chisq_Pinv(P, nu)
gsl_ran_chisq_Qinv(Q, nu)

These functions compute the cumulative distribution functions $$P(x), Q(x)$$ and their inverses for the chi-squared distribution with nu degrees of freedom.