Universit´e Joseph Fourier L2/STA230
TP7: Chi-squared tests
The objective of this lecture is to realize several standard Chi-Squared tests. First, we consider the chi-squared goodness-of-fit test, then the chi-squared test for independence.
1 Chi-squared goodness-of-fit test
We want to realize a goodness-of-fit test to establish whether or not the empirical distri- bution of the weights differs from the the normal distribution with expectation parameter
¯
x and variance parameter s2, estimated from the data.
1. Open the data “BB.csv”.
2. Give the assumptions H0 and H1 of the goodness-of-fit test.
3. Give the statistic and the decision rule of this test.
4. Compute the observed distribution table of the weights.
5. Compute the theoretical distribution table of the normal distribution with expecta- tion parameter µ= 3000 and variance σ2 = 600000.
6. Choose the classes such that the expected cell count is 5 or more.
7. Compute the chi-squared statistic χ2, measuring the distance between the two dis- tributions
8. Realize the goodness-of-fit test.
9. Conclude and comment.
2 Chi-squared test for independence
1. We want to test if there is independence between the weight of their babies and the smoking status of the mother. We use the variable lowfor the weight.
(a) Give the assumptions H0 and H1 of the independence test.
(b) Give the statistic and the decision rule of this test.
(c) Construct the empirical joint distribution table of the smoking status and the weights.
(d) Construct the theoretical joint distribution when the hypothesis of indepen- dence is true.
(e) If needed, reorganize the cells.
(f) Compute the chi-squared statistic χ2. (g) Conclude and comment.
2. We want to test if there is independence between the age of the mothers and the weight of their babies.
(a) Give the assumptions H0 and H1 of the independence test.
(b) Give the statistic and the decision rule of this test.
(c) Construct the empirical joint distribution table of the ages and the weights.
(d) Construct the theoretical joint distribution when the hypothesis of indepen- dence is true.
(e) If needed, reorganize the cells.
(f) Compute the chi-squared statistic χ2. (g) Conclude and comment.
2