The chi-squared distribution has a simple definition from a mathematical standpoint and yet plays an important role in statistical sampling theory. This post is the first post in a three-part series that gives a mathematical story of the chi-squared distribution.
This post is an introduction which highlights the fact that mathematically chi-squared distribution arises from the gamma distribution and that the chi-squared distribution has an intimate connection with the normal distribution. This post lays the ground work for the subsequent post.
The next post (Part 2) describe the roles played by the chi-squared distribution in forming the various sampling distributions related to the normal distribution. These sampling distributions are used for making inference about the population from which the sample is taken. The population parameters of interest here are the population mean, variance, and standard deviation. The population from which the sample is take is assumed to be modeled adequately by a normal distribution.
Part 3 describes the chi-squared test, which is used for making inference on categorical data (versus quantitative data).
These three parts only scratches the surface with respect to the roles played the chi-squared distribution in statistics. Thus the discussion in this series only serves as an introduction on chi-squared distribution.
Defining the Chi-Squared Distribution
A random variable is said to follow the chi-squared distribution with degrees of freedom if the following is the density function of .
where is a positive integer. In some sources, the distribution is sometimes named distribution. Essentially the distribution defined in is a gamma distribution with shape parameter and scale parameter 2 (or rate parameter ). Note that the chi-squared distribution with 2 degrees of freedom (when ) is simply an exponential distribution with mean 2. The following figure shows the chi-squared density functions for degrees of freedom 1, 2, 3, 5 and 10.
Figure 1 – Chi-squared Density Curves
Just from the gamma connection, the mean and variance are and . In other words, the mean of a chi-squared distribution is the same as the degrees of freedom and its variance is always twice the degrees of freedom. As a gamma distribution, the higher moments are also known. Consequently the properties that depend on can be easily computed. See here for the basic properties of the gamma distribution. The following gives the mean, variance and the moment generating function (MGF) for the chi-squared random variable with degrees of freedom.
Independent Sum of Chi-Squared Distributions
In general, the MGF of an independent sum is simply the product of the MGFs of the individual random variables . Note that the product of Chi-squared MGFs is also a Chi-squared MGF, with the exponent being the sum of the individual exponents. This brings up another point that is important for the subsequent discussion, i.e. the independent sum of chi-squared distributions is also a chi-squared distribution. The following theorem states this fact more precisely.
If are chi-squared random variables with degrees of freedom , respectively, then the independent sum has a chi-squared distribution with degrees of freedom.
Thus the result of summing independent chi-squared distributions is another chi-squared distribution with degree of freedom being the total of all degrees of freedom. This follows from the fact that if the gamma distributions have identical scale parameter, then the independent sum is a gamma distribution with the shape parameter being the sum of the shape parameters. This point is discussed in more details here.
The Connection with Normal Distributions
As shown in the above section, the chi-squared distribution is simple from a mathematical standpoint. Since it is a gamma distribution, it possesses all the properties that are associated with the gamma family. Of course, the gamma connection is far from the whole story. One important fact is that the chi-squared distribution is naturally obtained from sampling from a normal distribution.
Suppose that the random variable follows a standard normal distribution, i.e. the normal distribution with mean 0 and standard deviation 1. Then follows a chi-squared distribution with 1 degree of freedom.
By definition, the following is the cumulative distribution function (CDF) of .
Upon differentiating , the density function is obtained.
Note that the density is that of a chi-squared distribution with 1 degree of freedom.
With the basic result in Theorem 1, there are more ways to obtain chi-squared distributions from sampling from normal distributions. For example, first normalizing a sample item from normal sampling and then squaring it will produce a chi-squared observation with 1 degree of freedom. Similarly, by performing the same normalizing in each sample item in a normal sample and by squaring each normalized observation, the resulting sum is a chi-squared distribution. These are made more precise in the following corollaries.
Suppose that the random variable follows a normal distribution with mean and standard deviation . Then follows a chi-squared distribution with 1 degree of freedom.
Suppose that is a random sample drawn from a normal distribution with mean and standard deviation . Then the following random variable follows a chi-squared distribution with degrees of freedom.
Calculating Chi-Squared Probabilities
In working with the chi-squared distribution, it is necessary to evaluate the cumulative distribution function (CDF). In hypothesis testing, it is necessary to calculate the p-value given the value of the chi-squared statistic. In confidence interval estimation, it is necessary to determine the the critical value at a given confidence level. The standard procedure at one point in time is to use a chi-squared table. A typical chi-squared table can be found here. We demonstrate how to find chi-squared probabilities first using the table approach and subsequently using software (Excel in particular).
The table gives the probabilities on the right tail. The table in the link given above will give the chi-squared value (on the x-axis) for a given area of the right tail () per df. This table lookup is illustrated in the below diagram.
Figure 2 – Right Tail of Chi-squared Distribution
For df = 1, , thus and . So for df = 1, the 90th percentile of the chi-squared distribution is 2.706. The following shows more table lookup.
df = 2, .
The 99th percentile of the chi-squared distribution with df = 2 is 9.210.
df = 15, .
The 10th percentile of the chi-squared distribution with df = 15 is 8.547.
The choices for in the table are limited. Using software will have more selection for and will give more precise values. For example, Microsoft Excel provides the following two functions.
=CHISQ.DIST(x, degree_freedom, cumulative)
The two functions in Excel give information about the left-tail of the chi-squared distribution. The function CHISQ.DIST returns the left-tailed probability of the chi-squared distribution. The parameter cumulative is either TRUE or FALSE, with TRUE meaning that the result is the cumulative distribution function and FALSE meaning that the result is the probability density function. On the other hand, the function CHISQ.INV returns the inverse of the left-tailed probability of the chi-squared distribution.
If the goal is to find probability given an x-value, use the function CHISQ.DIST. On the other hand, if the goal is to look for the x-value given the left-tailed value (probability), then use the function CHISQ.INV. In the table approach, once the value is found, the interplay between the probability () and x-value is clear. In the case of Excel, one must choose the function first depending on the goal. The following gives the equivalent results for the table lookup presented above.
=CHISQ.DIST(2.706, 1, TRUE) = 0.900028622
=CHISQ.INV(0.9, 1) = 2.705543454
=CHISQ.DIST(9.21, 2, TRUE) = 0.989998298
=CHISQ.INV(0.99, 2) = 9.210340372
=CHISQ.DIST(8.547, 15, TRUE) = 0.100011427
=CHISQ.INV(0.1, 15) = 8.546756242