χ2 Distribution

The χ2 Distribution is one of the distributions we will be using during the course. Unlike the normal and t-distributions that are symmetric, the χ2-distribution is skewed to the right. Like the t-distribution, the χ2-distribution consists of a whole family of distributions distinguished by a single whole number parameter, ν , called the number of degrees of freedom. This value of ν determines the skewness of the graph.
We will use the χ2 Distribution in three applications:
(a) Estimating a Population Variance
(b) Performing a Goodness-of-fit Test
(c) Contingency Tables
In all three applications, we will
be looking for the value of the test statistic χ2 ....What
is this χ2
statistic?
Think about this experiment: You toss a coin 100 times. Of course, we can
simulate this experiment using the TI calculator with the function randInt(1,2,100)->
L1. Then, we can sort the data and count the number of ones( tails) (or
twos (heads)) we got. I did the experiment and I got 54 ones ( 46 twos). If we
perform the experiment several times, we can get different values, or some of
them could be repeated. We will call these , the observed (O)
values. Before performing the experiment, we expected to get 50-50, if the coin
is fair. We will call these, the expected (E) values. We call
these the expected values because if we perform this experiment many many times,
we expect to get equal number of tails and heads. This conviction is based on
the fact that the probability of getting a tail or a head is 50-50%( if the coin
is fair!). So, if we perform this experiment many many times, we will not be
surprised of getting an average of 50 tails ( or 50 heads!). Now, look at the
number defined as: [ (Oheads-E)2 + (Otails
- E)2] / E . If we use the values we got before (54,46), then this
number will be equal [ (46-50)2 + (54-50)2] / 50 =
0.64. This number is what we call the χ2
statistic. Observe that this number has to be a positive number. The amazing
thing is that if we perform this experiment many many times, the distribution of
the χ2 statistic values is not arbitrary, but
follows a distribution called the χ2 distribution.
The expression of the χ2 function is:
as you can see, the function depends on an additional parameter, ν, the degrees of freedom.
To check how accurate are the predictions using this formula, I have
performed three experiments.
In the first one, I have simulated tossing a coin 500 times, and then I repeated the experiment 500 times. I have compared the values obtained in the experiments(O), with the values calculated(E) using the above formula for the intervals, 0-1, 1-2, 2-3, ....12-13. In this case we have 1 degree of freedom (ν=1). (At the end, you can find the program I wrote to make the simulation.)
|
![]() |
In the second experiment, I have simulated tossing a die 500 times, and then I have repeated the experiment 500 times. In this case the number the degrees of freedom is ν=5, and the value of χ2 is given by the expression:
χ2 = [(n1-m)2 + (n2-m)2 +(n3-m)2 +(n4-m)2 +(n5-m)2 +(n6-m)2 ] / m
where, ni is the number of times we observed the number i, and m is the expected value which is the total number of trials divided by 6. The results are in the next table:
|
|
In the third experiment, I have simulated tossing a soccerball-like die( 12 faces!) 500 times, and then I have repeated the experiment 500 times. In this case the number the degrees of freedom is ν=11, and the value of χ2 is given by the expression:
where, mi is the number of times we observed the number i, and m is the expected value which is the total number of trials divided by 12. The results are in the next table:
|
![]() |
I find all of this really amazing!. You see that there is some order, some
logic behind all of these statistical fluctuations! Why?...I don't know.
If you get a result like this in Physics, you say:...there is some law of
conservation behind these numbers!...but, what we have here?...We are talking
about coins and dice!.
Programs for simulation:
|
Program for Simulation in TI-89: Coins()
|
Program for Simulation in TI-89: Dice()
|