Presentation is loading. Please wait.

Presentation is loading. Please wait.

The Chi-square goodness of fit test

Similar presentations


Presentation on theme: "The Chi-square goodness of fit test"— Presentation transcript:

1 The Chi-square goodness of fit test

2 Chi-square goodness of fit
Core issue in statistics: When are you viewing just random noise and when is there a real trend? Example: To see if squash shape & color are linked genes do a test cross. x GgLl ggll 1 : : : 1 ????

3 When to use a chi-square test
Your response variable is count data. You have more than one category of the response variable. You have a hypothesis for the responses you expect. There are lots of different statistical tests to use. You have to take into consideration what kind of data and hypothesis you are testing to find which test is appropriate. You want to know if the difference between the responses you observe and the responses you expect is significant or not.

4 Turn a hypothesis into a number
Your hypothesis tells you what you expect any given response (observation) to be. Turn your expectation into a fraction or percentage. Example hypothesis: “The MSU football team will win every single game this season.” So, according to my hypothesis, I expect MSU’s chance of winning any game is ___%. 100% Does this mean MSU will win 100% of their games? Example hypothesis: “The MSU football team’s number of wins and losses will be random.” So, according to this new hypothesis, I expect the team’s chance of winning any game is ___%. 50%

5 Turn a hypothesis into a number
Hyp.: “People over the age of 60 are 50% more likely to attend a baseball game than younger people.” So, according to my hypothesis if I go to a baseball game and find out the ages for all the fans in the audience, I expect the odds of any one fan being > 60 to be… x+ (x-50) = 100, solve for x. 75% or 3 out of 4. What are the odds a fan will be < 60 years old?

6 Turn a hypothesis into a number
“Pre-hypothesis”: Given the choice, people prefer red and blue m&m’s over the other 4 colors. But don’t know how strong their preference might be. So test the “null hypothesis”—People choose m&m colors at random, i.e. they don’t show preference. (vs. “alternative” or “experimental” hypothesis). So, according to my null hypothesis, if I hand around a bowl of m&ms, I expect the chance of each color being chosen is… 1/6 or 16.67%. Use chi square test to see if what you actually observe is significantly different from 1/6. Null hypothesis is always “there is no difference between groups”. 1/6 means there is an equal chance of someone choosing any one of the 6 colors.

7 The chi-square test Observed Expected
The chi-square test determines whether or not the difference between the responses you observe and the responses you expect is significant. Significant = not due to random chance alone. Calculate the “strength of the difference”, get a value that tells you the probability the difference is due to chance (random noise) alone. If this probability is small (<5%), we conclude there is a significant difference (the difference is not simply due to chance) between obs and exp values. Observed Expected Game % fans > 60 years old 1 69 2 80 3 20 4 55 5 67 6 76 7 47 8 81 9 70 10 68 Game % fans > 60 years old 1 75 2 3 4 5 6 7 8 9 10

8 Interpreting the chi-square test
Hypothesis: “People over the age of 60 are 50% more likely to attend a baseball game than younger people.” If the test tells you your data are not significantly different from what you expect, (your data have a “good fit” to the expected values), you support the hypothesis. Note: no statistical test ever proves a hypothesis! If the test tells you your data are significantly different from what you expect, you reject the hypothesis. Observed Expected Game % fans > 60 years old 1 69 2 80 3 20 4 55 5 67 6 76 7 47 8 81 9 70 10 68 Game % fans > 60 years old 1 75 2 3 4 5 6 7 8 9 10

9 Σ What is chi-square? “Chi-square” symbol is χ2 (Greek).
χ2 = (Observed – Expected)2 Expected Based on your hypothesis! Σ “Sum of” Observed Expected Obs-Exp (Obs-Exp)2 Exp Category 1 Category 2 χ2 total Degrees of Freedom Number of categories minus 1 = N-1

10 Example problem #1 χ2 total Observed Expected Obs-Exp
A university biology department would like to hire a new professor. They advertised the opening and received 220 applications, 25% of which came from women. The department came up with a “short list” of their favorite 25 candidates, 5 women and 20 men, for the job. You want to know if there is evidence for the search committee being biased against women. Note: If the committee is unbiased the proportion of women in the short list should match the proportion of women in all the applications. Define your hypothesis. Set up table. Women: 25 * 0.25 = Men: 25 * 0.75 = Observed Expected Obs-Exp (Obs-Exp)2 Exp χ2 total Degrees of Freedom Women 5 6.25 -1.25 1.5625 0.25 Men 20 18.75 1.25 1.5625 0.08 = 0.33 1

11 Chi-square probability table
Probabilities  Observed values not significantly different from expected (differences due to random chance). Support hypothesis. Reject hyp. Observed values are significantly different from expected (differences not just due to random chance). Reject hypothesis.

12 Chi-square probability table
Probabilities  Observed values not significantly different from expected (differences due to random chance). Support hypothesis. Reject hyp. Probability range: 0.5 < p < 0.6 Means that there is a 50-60% probability that the difference between obs & exp values are from random chance alone. Observed values are significantly different from expected (differences not just due to random chance). Reject hypothesis. So, is the department biased against women applicants?

13 Example problem #2 Work in groups

14 Example problem #2 χ2 total Observed Expected Obs-Exp
Hypothesis: Expected values: Body color and wing size are unlinked genes. Gray Normal wings (GgWw): 9/16 * 102 = Gray Vestigial wings (Ggww): Expected ratio? 3/16 * 102 = 9:3:3:1. Ebony Normal wings (ggWw): Ebony Vestigial (ggww): 1/16 * 102 = 6.375 Observed Expected Obs-Exp (Obs-Exp)2 Exp χ2 total Degrees of Freedom Gray Norm. 53 57.375 -4.375 19.141 0.333 Gray Vest. 16 19.125 -3.125 9.766 0.511 Ebony Norm. 25 19.125 5.875 34.516 1.805 8 1.625 Ebony Vest. 6.375 2.641 0.414 = 3.063 3

15 Chi-square probability table
Probabilities  Reject hyp. Support hypothesis. Probability range: 0.3 < p < 0.4 Means that there is a 30-40% probability that the difference between obs & exp values are from random chance alone. Biology?

16 Example problem #3 Using Chi-square to test for linked genes

17 Example problem #3 1:0:0:1 Hypothesis:
Squash color and shape are not linked genes. OR Squash color and shape are linked genes. Describe the phenotypes and circle the recombinants. LlGg llGg llgg Llgg 3. If the 2 genes are not linked the expected ratio is: 1:1:1:1 4. If the two genes are linked the expected phenotype ratio is: 1:0:0:1

18 Example problem #3 χ2 total Observed Expected Obs-Exp
If you tested the hypothesis that squash shapre and color ARE LINKED (1:1:1:1) : 5. Calculate the expected number of offspring for each phenotype: Wild Wild (LlGg) : 509/4 = Wild Orange (Llgg) : 127.25 Round Wild (llGg) : Round Orange (llgg) : Observed Expected Obs-Exp (Obs-Exp)2 Exp χ2 total Degrees of Freedom Wild Wild 228 127.25 100.75 79.8 Wild Orange 17 127.25 95.5 Round Wild 21 127.25 88.7 243 115.75 Round Orange 127.25 105.3 369.3 3

19 Chi-square probability table
Probability range: 0.3 < p < 0.4 Probabilities  Reject hyp. Support hypothesis. Statistical meaning: 30-40% probability that the difference between obs & exp values are from random chance alone. The obs and exp values are not significantly different. Support hypothesis. Biological meaning?

20 Example problem #3 χ2 total Observed Expected Obs-Exp
If you tested the hypothesis that squash shapre and color ARE NOT LINKED (1:0:0:1) : 5. Calculate the expected number of offspring for each phenotype: Wild Wild (LlGg) : 509/2 = 254.5 Wild Orange (Llgg) : Round Wild (llGg) : Round Orange (llgg) : 509/2=254.5 Observed Expected Obs-Exp (Obs-Exp)2 Exp χ2 total Degrees of Freedom Wild Wild 228 254.5 -26.5 702.25 2.76 Wild Orange 17 17 289 (Undef.) 0 Round Wild 21 21 441 (Undef.) 0 243 Round Orange 254.5 -11.5 132.25 0.52 3.28 3

21 Chi-square probability table
Probability range: p < 0.01 Probabilities  Reject hyp. Support hypothesis. Statistical meaning: < 1% probability that the difference between obs & exp values are from random chance alone. The obs and exp values are significantly different. Reject hypothesis. Biological meaning?

22 Example problem #3 Hypothesis not linked  p<0.01  Reject hypothesis Hypothesis linked  0.3 < p < 0.4, in other words, p > 0.05  Support hypothesis Are these test results in agreement? So do these data show that the genes are linked or not? If you weren’t very confident in your test results, what could you do next to improve your confidence?


Download ppt "The Chi-square goodness of fit test"

Similar presentations


Ads by Google