39.7. CONTINGENCY TABLES 839

p5 =1√

2π√

347.24

∫ 90

80e−

12(x−56.5)2

347.24 dx = 6.7526×10−2

p6 =1√

2π√

347.24

∫∞

90e−

12(x−56.5)2

347.24 dx = 3.6108×10−2

Assemble D. After some computations one finds

D = 134.96

Now since there are two parameters, D is X 2 (3) ,(6−1)−2. If you use the data cursoron a graph of the distribution function, you find the pair (15.3, .9984). Thus if the nullhypothesis is true that this sample is normally distributed, it would involve a probabilityof less than .01. Therefore, the null hypothesis can be rejected with probability larger than.99. This isn’t quite true of course. Clearly if you used more disjoint intervals, you shouldbe more sure that the approximation is good, so there is a little fuzziness in this goodness offit test. However, it does help to quantify the appearance that the distribution is not normal.In the above example, this seems fairly clear just from looking at the scores, but this allowsyou to give numbers to justify its lack of normality.

Incidentally, if you are not careful, you can get such a distribution of scores on a fi-nal exam. All you need are faculty who wax creative rather than focussing on publishedoutcomes. One wonders whether it is reasonable to base assigning letter grades on an as-sumption that the final exam scores are normally distributed, if the hypothesis that this isso can be rejected with high probability according to the above procedure. However, Ithink that it is often the case that people who follow these automatic procedures do not dogoodness of fit tests like that just described.

PROCEDURE 39.6.7 If the distribution depends on s parameters, modify Pro-cedure 39.6.5 as follows. First replace each parameter with its maximum likelihood esti-mate then do exactly the same thing to define D only this time, it is X 2 ((r−1)− s).

39.7 Contingency TablesAnother application of Proposition 39.6.2 and its generalization to when the distributiondepends on parameters is to the notion of contingency tables. These can come in any sizeincluding more than two dimensions, but I will give a simple example to illustrate and leaveto the reader whatever generalization is appropriate. Here is such a table.

A1 A2 A3

B1 p11 p12 p13

B2 p21 p22 p23

For example, you might be looking at the people in a city and B1 is the event that theperson is female and B2 the event that the person is male while A1 might be that the personis a democrat, A2 the person is a republican and A3 the person is neither one. A givenperson will be in exactly one of the Ai∩B j.

The numbers pi j are probabilities and ∑ j ∑i pi j = 1. Thus there is a random variable Zand pi j is P(Z ∈ Ai∩B j) = P(Ai∩B j). Denote as p· j the marginal probability ∑i pi j and