Top Banner
Chapter 28: The Chi-Square Test Suppose we have a die and ask “Is it fair?” First thing to do is to get some data:
20

Suppose we have a die and ask “Is it fair?” First thing to ...

May 01, 2022

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Suppose we have a die and ask “Is it fair?” First thing to ...

Chapter 28: The Chi-Square Test

Suppose we have a die and ask

“Is it fair?”

First thing to do is to get some data:

Page 2: Suppose we have a die and ask “Is it fair?” First thing to ...

Null hypothesis: The die is fair. Alt hypothesis: The die is not fair. Box model for the null: The rolls are like 60 draws with replacement from the box We can do the test using χ2 = sum of We compare our value of χ2 to the chi-square table to get a p-value. Degree of freedom = number of rows – 1.

1 2 4 3 5 6

Page 3: Suppose we have a die and ask “Is it fair?” First thing to ...

Number Observed Of spots frequency 1 4 2 6 3 17 4 16 5 8 6 9 60

Page 4: Suppose we have a die and ask “Is it fair?” First thing to ...
Page 5: Suppose we have a die and ask “Is it fair?” First thing to ...

Rolling a fair die – the probability histogram and the χ2 curve with 5 degrees of freedom

Page 6: Suppose we have a die and ask “Is it fair?” First thing to ...
Page 7: Suppose we have a die and ask “Is it fair?” First thing to ...

Example 1. Candy comes wrapped in foil of 3 colors: pink, blue and purple. We buy some of the candy and find the following: Foil Observed Color frequency Pink Blue Purple We will test the null hypothesis that the foil colors are equally likely against the alternative that they are not equally likely, assuming that this is a random sample of this type of candy.

Page 8: Suppose we have a die and ask “Is it fair?” First thing to ...
Page 9: Suppose we have a die and ask “Is it fair?” First thing to ...

Example 2. A computer program is supposed to generate the designs: ♣ ♥ ♠ ♦ at random. In 1000 tries, we find: Design Frequency ♣ 271 ♠ 237 ♦ 235 ♥ 257 Is there something wrong with the program?

Page 10: Suppose we have a die and ask “Is it fair?” First thing to ...
Page 11: Suppose we have a die and ask “Is it fair?” First thing to ...

Testing for too Little Chance Error

In any chance process we expect a certain amount of chance error. For example, we would not expect to get exactly ten 1’s, ten 2’s, …, and ten 6’s in 60 rolls of a die. This would seem “too good to be true” and we might wonder if the results really happened or if someone made them up. If we suspect dishonesty, we could test: null hypothesis: the chance model is correct alt hypothesis: someone cheated by computing the test statistic in the usual way but computing a left-tail p-value as in the following example.

Page 12: Suppose we have a die and ask “Is it fair?” First thing to ...

Example 3. Genetic theory shows that when two pink snapdragons are crossed, we should expect ½ the offspring to be pink, ¼ red and ¼ white. Suppose we learn of an experiment in which 98 are red, 101 are white, and 201 are pink. Is there evidence that this research is less than honest?

Page 13: Suppose we have a die and ask “Is it fair?” First thing to ...
Page 14: Suppose we have a die and ask “Is it fair?” First thing to ...

Testing Independence

Sometimes, we have two variables of interest and we know how many times each combination of values occurs in our sample. If the sample is a simple random sample from the population, we can test: null hypothesis: the two variables are independent in the population alt hypothesis: the two variables are NOT independent in the population

In this case, we get expected counts by assuming independence and we compute the test statistic in the usual way, except that we use df = (number of rows – 1) x (number of cols – 1).

Page 15: Suppose we have a die and ask “Is it fair?” First thing to ...

Example 4. The following table represents a simple random sample taken from a population. Is there evidence that handedness and gender are not independent in this population?

Page 16: Suppose we have a die and ask “Is it fair?” First thing to ...
Page 17: Suppose we have a die and ask “Is it fair?” First thing to ...

Example 5. A simple random sample of 200 Utah schoolchildren are asked whether or not they like math. There are 102 boys, of whom 41 like math, and 98 girls, of whom 29 like math. Is liking math independent of gender for Utah schoolchildren?

Page 18: Suppose we have a die and ask “Is it fair?” First thing to ...
Page 19: Suppose we have a die and ask “Is it fair?” First thing to ...

Example 6. The following table represents a simple random sample of 1000 drivers. The drivers were asked whether or not they used a cell phone while driving and whether or not they had had an accident while driving. Test the hypothesis that cell phone use is independent of accident rate for the population from which this sample is taken.

Accident No Accident Total

Cell phone?

Yes 26 239 265 No 22 713 735

Total 48 952 1000

Page 20: Suppose we have a die and ask “Is it fair?” First thing to ...