![]() | ||
Notation χ 2 ( k ) {displaystyle chi ^{2}(k)!} or χ k 2 {displaystyle chi _{k}^{2}!} Support x ∈ [ 0 , + ∞ ) {displaystyle xin [0,+infty )} PDF 1 2 k 2 Γ ( k 2 ) x k 2 − 1 e − x 2 {displaystyle {rac {1}{2^{rac {k}{2}}Gamma left({rac {k}{2}}ight)}};x^{{rac {k}{2}}-1}e^{-{rac {x}{2}}},} CDF 1 Γ ( k 2 ) γ ( k 2 , x 2 ) {displaystyle {rac {1}{Gamma left({rac {k}{2}}ight)}};gamma left({ frac {k}{2}},,{rac {x}{2}}ight)} Mean k {displaystyle k} |
In probability theory and statistics, the chi-squared distribution (also chi-square or χ2-distribution) with
Contents
- Definition
- Introduction
- Characteristics
- Probability density function
- Differential equation
- Cumulative distribution function
- Additivity
- Sample mean
- Entropy
- Noncentral moments
- Cumulants
- Asymptotic properties
- Relation to other distributions
- Generalizations
- Linear combination
- Noncentral chi squared distribution
- Generalized chi squared distribution
- Gamma exponential and related distributions
- Occurrence and applications
- Table of 2 values vs p values
- History and name
- References
The chi-squared distribution is used in the common chi-squared tests for goodness of fit of an observed distribution to a theoretical one, the independence of two criteria of classification of qualitative data, and in confidence interval estimation for a population standard deviation of a normal distribution from a sample standard deviation. Many other statistical tests also use this distribution, like Friedman's analysis of variance by ranks.
Definition
If Z1, ..., Zk are independent, standard normal random variables, then the sum of their squares,
is distributed according to the chi-squared distribution with k degrees of freedom. This is usually denoted as
The chi-squared distribution has one parameter: k — a positive integer that specifies the number of degrees of freedom (i. e. the number of Zi’s)
Introduction
The chi-squared distribution is used primarily in hypothesis testing. Unlike more widely known distributions such as the normal distribution and the exponential distribution, the chi-squared distribution is rarely used to model natural phenomena. It arises in the following hypothesis tests, among others.
It is also a component of the definition of the t-distribution and the F-distribution used in t-tests, analysis of variance, and regression analysis.
The primary reason that the chi-squared distribution is used extensively in hypothesis testing is its relationship to the normal distribution. Many hypothesis tests use a test statistic, such as the t statistic in a t-test. For these hypothesis tests, as the sample size, n, increases, the sampling distribution of the test statistic approaches the normal distribution (Central Limit Theorem). Because the test statistic (such as t) is asymptotically normally distributed, provided the sample size is sufficiently large, the distribution used for hypothesis testing may be approximated by a normal distribution. Testing hypotheses using a normal distribution is well understood and relatively easy. The simplest chi-squared distribution is the square of a standard normal distribution. So wherever a normal distribution could be used for a hypothesis test, a chi-squared distribution could be used.
Specifically, suppose that Z is a standard normal random variable, with mean = 0 and variance = 1. Z ~ N(0,1). A sample drawn at random from Z is a sample from the distribution shown in the graph of the standard normal distribution. Define a new random variable Q. To generate a random sample from Q, take a sample from Z and square the value. The distribution of the squared values is given by the random variable Q = Z2. The distribution of the random variable Q is an example of a chi-squared distribution:
An additional reason that the chi-squared distribution is widely used is that it is a member of the class of likelihood ratio tests (LRT). LRT's have several desirable properties; in particular, LRT's commonly provide the highest power to reject the null hypothesis (Neyman–Pearson lemma). However, the normal and chi-squared approximations are only valid asymptotically. For this reason, it is preferable to use the t distribution rather than the normal approximation or the chi-squared approximation for small sample size. Similarly, in analyses of contingency tables, the chi-squared approximation will be poor for small sample size, and it is preferable to use Fisher's exact test. Ramsey and Ramsey show that the exact binomial test is always more powerful than the normal approximation.
Lancaster shows the connections among the binomial, normal, and chi-squared distributions, as follows. De Moivre and Laplace established that a binomial distribution could be approximated by a normal distribution. Specifically they showed the asymptotic normality of the random variable
where m is the observed number of successes in N trials, where the probability of success is p, and q = 1 − p.
Squaring both sides of the equation gives
Using N = Np + N(1 − p), N = m + (N − m), and q = 1 − p, this equation simplifies to
The expression on the right is of the form that Pearson would generalize to the form:
where
In the case of a binomial outcome (flipping a coin), the binomial distribution may be approximated by a normal distribution (for sufficiently large n). Because the square of a standard normal distribution is the chi-squared distribution with one degree of freedom, the probability of a result such as 1 heads in 10 trials can be approximated either by the normal or the chi-squared distribution. However, many problems involve more than the two possible outcomes of a binomial, and instead require 3 or more categories, which leads to the multinomial distribution. Just as de Moivre and Laplace sought for and found the normal approximation to the binomial, Pearson sought for and found a multivariate normal approximation to the multinomial distribution. Pearson showed that the chi-squared distribution, the sum of multiple normal distributions, was such an approximation to the multinomial distribution
Characteristics
Further properties of the chi-squared distribution can be found in the box at the upper right corner of this article.
Probability density function
The probability density function (pdf) of the chi-square distribution is
where
For derivations of the pdf in the cases of one, two and k degrees of freedom, see Proofs related to chi-squared distribution.
Differential equation
The pdf of the chi-squared distribution is a solution to the following differential equation:
Therefore,
Integrating both sides,
Therefore,
Total probability (i.e. area under the curve y = f(x) from -Infinity to +Infinity) needs to be 1.
Therefore, Total Probability
Hence, PDF
Cumulative distribution function
Its cumulative distribution function is:
where
In a special case of k = 2 this function has a simple form:
and the form is not much more complicated for other small even k.
Tables of the chi-squared cumulative distribution function are widely available and the function is included in many spreadsheets and all statistical packages.
Letting
The tail bound for the cases when
For another approximation for the CDF modeled after the cube of a Gaussian, see under Noncentral chi-squared distribution.
Additivity
It follows from the definition of the chi-squared distribution that the sum of independent chi-squared variables is also chi-squared distributed. Specifically, if {Xi}i=1n are independent chi-squared variables with {ki}i=1n degrees of freedom, respectively, then Y = X1 + ⋯ + Xn is chi-squared distributed with k1 + ⋯ + kn degrees of freedom.
Sample mean
The sample mean of
Asymptotically, given that for a scale parameter
Note that we would have obtained the same result invoking instead the central limit theorem, noting that for each chi-squared variable of degree
Entropy
The differential entropy is given by
where ψ(x) is the Digamma function.
The chi-squared distribution is the maximum entropy probability distribution for a random variate X for which
Noncentral moments
The moments about zero of a chi-squared distribution with k degrees of freedom are given by
Cumulants
The cumulants are readily obtained by a (formal) power series expansion of the logarithm of the characteristic function:
Asymptotic properties
By the central limit theorem, because the chi-squared distribution is the sum of k independent random variables with finite mean and variance, it converges to a normal distribution for large k. For many practical purposes, for k > 50 the distribution is sufficiently close to a normal distribution for the difference to be ignored. Specifically, if X ~ χ2(k), then as k tends to infinity, the distribution of
The sampling distribution of ln(χ2) converges to normality much faster than the sampling distribution of χ2, as the logarithm removes much of the asymmetry. Other functions of the chi-squared distribution converge more rapidly to a normal distribution. Some examples are:
Relation to other distributions
A chi-squared variable with k degrees of freedom is defined as the sum of the squares of k independent standard normal random variables.
If Y is a k-dimensional Gaussian random vector with mean vector μ and rank k covariance matrix C, then X = (Y−μ)TC−1(Y − μ) is chi-squared distributed with k degrees of freedom.
The sum of squares of statistically independent unit-variance Gaussian variables which do not have mean zero yields a generalization of the chi-squared distribution called the noncentral chi-squared distribution.
If Y is a vector of k i.i.d. standard normal random variables and A is a k×k symmetric, idempotent matrix with rank k−n then the quadratic form YTAY is chi-squared distributed with k−n degrees of freedom.
The chi-squared distribution is also naturally related to other distributions arising from the Gaussian. In particular,
Generalizations
The chi-squared distribution is obtained as the sum of the squares of k independent, zero-mean, unit-variance Gaussian random variables. Generalizations of this distribution can be obtained by summing the squares of other types of Gaussian random variables. Several such distributions are described below.
Linear combination
If
Noncentral chi-squared distribution
The noncentral chi-squared distribution is obtained from the sum of the squares of independent Gaussian random variables having unit variance and nonzero means.
Generalized chi-squared distribution
The generalized chi-squared distribution is obtained from the quadratic form z′Az where z is a zero-mean Gaussian vector having an arbitrary covariance matrix, and A is an arbitrary matrix.
Gamma, exponential, and related distributions
The chi-squared distribution
Because the exponential distribution is also a special case of the Gamma distribution, we also have that if
The Erlang distribution is also a special case of the Gamma distribution and thus we also have that if
Occurrence and applications
The chi-squared distribution has numerous applications in inferential statistics, for instance in chi-squared tests and in estimating variances. It enters the problem of estimating the mean of a normally distributed population and the problem of estimating the slope of a regression line via its role in Student’s t-distribution. It enters all analysis of variance problems via its role in the F-distribution, which is the distribution of the ratio of two independent chi-squared random variables, each divided by their respective degrees of freedom.
Following are some of the most common situations in which the chi-squared distribution arises from a Gaussian-distributed sample.
The chi-squared distribution is also often encountered in Magnetic Resonance Imaging.
Table of χ2 values vs p-values
The p-value is the probability of observing a test statistic at least as extreme in a chi-squared distribution. Accordingly, since the cumulative distribution function (CDF) for the appropriate degrees of freedom (df) gives the probability of having obtained a value less extreme than this point, subtracting the CDF value from 1 gives the p-value. The table below gives a number of p-values matching to χ2 for the first 10 degrees of freedom.
A low p-value indicates greater statistical significance, i. e., greater confidence that the observed deviation from the null hypothesis is significant. A p-value of 0.05 is often used as a cutoff between significant and not-significant results.
These values can be calculated evaluating the quantile function (also known as “inverse CDF” or “ICDF”) of the chi-squared distribution; e. g., the χ2 ICDF for p = 1 − 0.95 and df = 7 yields 14.067 ≈ 14.07 as in the table above. In Python, this can be calculated using SciPy via scipy.stats.chi2.isf(0.05, 7)
.
History and name
This distribution was first described by the German statistician Friedrich Robert Helmert in papers of 1875–6, where he computed the sampling distribution of the sample variance of a normal population. Thus in German this was traditionally known as the Helmert'sche ("Helmertian") or "Helmert distribution".
The distribution was independently rediscovered by the English mathematician Karl Pearson in the context of goodness of fit, for which he developed his Pearson's chi-squared test, published in 1900, with computed table of values published in (Elderton 1902), collected in (Pearson 1914, pp. xxxi–xxxiii, 26–28, Table XII). The name "chi-squared" ultimately derives from Pearson's shorthand for the exponent in a multivariate normal distribution with the Greek letter Chi, writing −½χ2 for what would appear in modern notation as −½xTΣ−1x (Σ being the covariance matrix). The idea of a family of "chi-squared distributions", however, is not due to Pearson but arose as a further development due to Fisher in the 1920s.