21. The chi-square test for goodness of fit

Slides:



Advertisements
Similar presentations
Quantitative Skills 4: The Chi-Square Test
Advertisements

Hypothesis Testing IV Chi Square.
Chapter 11 Inference for Distributions of Categorical Data
1-1 Copyright © 2015, 2010, 2007 Pearson Education, Inc. Chapter 25, Slide 1 Chapter 25 Comparing Counts.
Chi-square Goodness of Fit Test
Chapter 13: Inference for Tables – Chi-Square Procedures
Goodness-of-Fit Tests and Categorical Data Analysis
Copyright © 2010 Pearson Education, Inc. Warm Up- Good Morning! If all the values of a data set are the same, all of the following must equal zero except.
Analysis of two-way tables - Formulas and models for two-way tables - Goodness of fit IPS chapters 9.3 and 9.4 © 2006 W.H. Freeman and Company.
Chi-Square as a Statistical Test Chi-square test: an inferential statistics technique designed to test for significant relationships between two variables.
Analysis of two-way tables - Formulas and models for two-way tables - Goodness of fit IPS chapters 9.3 and 9.4 © 2006 W.H. Freeman and Company.
Copyright © 2010 Pearson Education, Inc. Warm Up- Good Morning! If all the values of a data set are the same, all of the following must equal zero except.
+ Chapter 11 Inference for Distributions of Categorical Data 11.1Chi-Square Goodness-of-Fit Tests 11.2Inference for Relationships.
Copyright © 2013, 2009, and 2007, Pearson Education, Inc. Chapter 11 Analyzing the Association Between Categorical Variables Section 11.2 Testing Categorical.
Lecture 11. The chi-square test for goodness of fit.
Chapter 13- Inference For Tables: Chi-square Procedures Section Test for goodness of fit Section Inference for Two-Way tables Presented By:
Lecture PowerPoint Slides Basic Practice of Statistics 7 th Edition.
Comparing Counts Chapter 26. Goodness-of-Fit A test of whether the distribution of counts in one categorical variable matches the distribution predicted.
+ Section 11.1 Chi-Square Goodness-of-Fit Tests. + Introduction In the previous chapter, we discussed inference procedures for comparing the proportion.
Chapter 11: Categorical Data n Chi-square goodness of fit test allows us to examine a single distribution of a categorical variable in a population. n.
Class Seven Turn In: Chapter 18: 32, 34, 36 Chapter 19: 26, 34, 44 Quiz 3 For Class Eight: Chapter 20: 18, 20, 24 Chapter 22: 34, 36 Read Chapters 23 &
11/12 9. Inference for Two-Way Tables. Cocaine addiction Cocaine produces short-term feelings of physical and mental well being. To maintain the effect,
Goodness-of-Fit A test of whether the distribution of counts in one categorical variable matches the distribution predicted by a model is called a goodness-of-fit.
Inference for Tables: Chi-Squares procedures (2 more chapters to go!)
Check your understanding: p. 684
CHAPTER 11 Inference for Distributions of Categorical Data
Comparing Counts Chi Square Tests Independence.
11.1 Chi-Square Tests for Goodness of Fit
The Chi Square Test A statistical method used to determine goodness of fit Chi-square requires no assumptions about the shape of the population distribution.
22. Chi-square test for two-way tables
Objectives (PSLS Chapter 22)
Objectives (BPS chapter 23)
Chapter 11: Inference for Distributions of Categorical Data
Chapter 25 Comparing Counts.
Chapter 11: Inference for Distributions of Categorical Data
22. Chi-square test for two-way tables
The Practice of Statistics in the Life Sciences Fourth Edition
The Chi Square Test A statistical method used to determine goodness of fit Goodness of fit refers to how close the observed data are to those predicted.
The Chi Square Test A statistical method used to determine goodness of fit Goodness of fit refers to how close the observed data are to those predicted.
AP Stats Check In Where we’ve been… Chapter 7…Chapter 8…
Chapter 11: Inference for Distributions of Categorical Data
Two Categorical Variables: The Chi-Square Test
Chapter 10 Analyzing the Association Between Categorical Variables
Overview and Chi-Square
The Chi Square Test A statistical method used to determine goodness of fit Goodness of fit refers to how close the observed data are to those predicted.
Analyzing the Association Between Categorical Variables
Chapter 11: Inference for Distributions of Categorical Data
Chapter 26 Comparing Counts.
Chapter 13: Inference for Distributions of Categorical Data
Chapter 11: Inference for Distributions of Categorical Data
Chapter 11: Inference for Distributions of Categorical Data
Chapter 11: Inference for Distributions of Categorical Data
Chapter 11: Inference for Distributions of Categorical Data
Chapter 11: Inference for Distributions of Categorical Data
Section 11-1 Review and Preview
Chapter 11: Inference for Distributions of Categorical Data
Chapter 26 Comparing Counts Copyright © 2009 Pearson Education, Inc.
Chapter 11: Inference for Distributions of Categorical Data
UNIT V CHISQUARE DISTRIBUTION
Chapter 11: Inference for Distributions of Categorical Data
S.M.JOSHI COLLEGE, HADAPSAR
Inference for Distributions of Categorical Data
Chapter 26 Comparing Counts.
Chapter 11: Inference for Distributions of Categorical Data
Chapter 11: Inference for Distributions of Categorical Data
Chapter 11: Inference for Distributions of Categorical Data
Analysis of two-way tables
Inference for Distributions of Categorical Data
Chapter 11: Inference for Distributions of Categorical Data
Presentation transcript:

21. The chi-square test for goodness of fit The Practice of Statistics in the Life Sciences Third Edition © 2014 W.H. Freeman and Company

Objectives (PSLS Chapter 21) The chi-square test for goodness of fit Idea of the chi-square test The chi-square distributions Goodness of fit hypotheses Conditions for the chi-square goodness of fit test Chi-square test for goodness of fit

Idea of the chi-square test The chi-square (c2) test is used when the data are categorical. It measures how different the observed data are from what we would expect if H0 was true. Observed sample proportions (1 SRS of 700 births) Expected proportions under H0: p1=p2=p3=p4=p5=p6=p7=1/7 Again, we want to know if differences in sample proportions are likely to have occurred by chance just because of the random sampling.

The chi-square statistic The chi-square (c2) statistic compares observed and expected counts. Observed counts are the actual number of observations of each type. Expected counts are the number of observations that we would expect to see of each type if the null hypothesis was true. (calculated for each type separately and then summed) Large values for c2 represent strong deviations from the expected distribution under H0, and will tend to be statistically significant.

The chi-square distributions The c2 distributions are a family of distributions that take only positive values, are skewed to the right, and are described by a specific degrees of freedom. Published tables & software give the upper-tail area for critical values of many c2 distributions.

Table D Ex: df = 6 If c2 = 15.9 the P-value is between 0.01−0.02.

Goodness of fit hypotheses The chi-square test can be used to for a categorical variable (1 SRS) with any number k of levels. The null hypothesis can be that all population proportions are equal (uniform hypothesis) Are hospital births uniformly distributed in the week? H0: p1 = p2 = p3 = p4 = p5 = p6 = p7 = 1/7 or that they are equal to some specific values, as long as the sum of all the population proportions in H0 equals 1. When crossing homozygote parents expressing two co-dominant phenotypes A and B, we would expect in F2 H0: pA = ¼ , pAB = ½ , pB = ¼ where AB is an intermediate phenotype.

For 1 SRS of size n with k levels of a categorical variable When testing H0: p1 = p2 = … = pk (a uniform distribution) The expected counts are all = n / k H0: p1 = p1H0 and p2 = p2H0 … and pk = pkH0 The expected counts in each level i are expected counti = n piH0 The expected counts do not need to be rounded to whole numbers. As much precision as possible should be retained when performing the calculations by step by step. Note: We will see in Chapter 22 that the chi-square test can also test more complex hypotheses for categorical data organized in two-way tables (looking at the relationship between two categorical variables).

Conditions for the goodness of fit test The chi-square test for goodness of fit is used when we have a single SRS from a population and the variable is categorical with k mutually exclusive levels. We can safely use the chi-square test when: all expected counts have values ≥ 1.0 no more than 20% of the k expected counts have values < 5.0 For every 5 levels, the test can accommodate 1 small-ish expected count (greater than 1.0 but smaller than 5.0). There are techniques to use if the expected counts are too low: you can either collapse some levels of the categorical variable, or you can use an “exact test” (not covered in this textbook).

Chi-square test for goodness of fit The chi-square statistic for goodness of fit with k proportions measures how much observed counts differ from expected counts. It follows the chi-square distribution with k − 1 degrees of freedom and has the formula: The P-value is the tail area under the X2 distribution with df = k – 1.

Expected counts are large enough Aphids evade predators (ladybugs) by dropping off the leaf. An experiment examined the mechanism of aphid drops. “When dropped upside-down from delicate tweezers, live aphids landed on their ventral side in 95% of the trials (19 out of 20). In contrast, dead aphids landed on their ventral side in 52.2% of the trials (12 out of 23).” Is there evidence (at significance level 5%) that live aphids’ landing right side up (on their ventral side) is not a chance event? We test H0: pventral = 0.5 and pdorsal = 0.5 Ha: H0 not true Observed counts Expected counts X2 contributions 19 1 20(0.5) = 10 (19 – 10)2/10 = 8.1 Expected counts are large enough P-value 0.00006

“When dropped upside-down from delicate tweezers, live aphids landed on their ventral side in 95% of the trials (19 out of 20). Is there evidence (at significance level 5%) that live aphids’ landing right side up (on their ventral side) is not a chance event? We test H0: pventral = 0.5 and pdorsal = 0.5 Ha: H0 not true From Table D, we find X2 > 12.12, so P < 0.0005 (software gives P-value = 0.00006), highly significant. We reject H0. We have found very strong evidence that the righting behavior of live aphids is not chance (P < 0.0005).

Interpreting the c2 output The individual values summed in the c2 statistic are the c2 components (or contributions). When the test is statistically significant, the largest components indicate which condition(s) are most different from the expected H0. Compare the observed and expected counts to interpret the findings. You can also compare the actual proportions qualitatively in a graph. Observed counts Expected counts X2 contributions 19 1 20(0.5) = 10 (19 – 10)2/10 = 8.1 The chi-square components (contributions) give a measure of the relative disparity between observed and expected counts for each condition. Aphids land the right side up (ventral side) a lot more often (95%) than chance alone would predict (50%).

Lack of significance: Avoid a logical fallacy A non-significant P-value is not conclusive: H0 could be true, or not. This is particularly relevant in the X2 goodness of fit test where we are often interested in H0 that the data fit a particular model. A significant P-value suggests that the data do not follow that model. But finding a non-significant P-value is NOT a validation of the null hypothesis and does NOT suggest that the data do follow the hypothesized model. It only shows that the data are not inconsistent with the model.

H0: pF = 1/4; pSF = 2/4; pS = 1/4 Ha: H0 is not true The Frizzle fowl is a chicken with curled feathers. A genetic crossing between Frizzle and Leghorn (straight-feathered) varieties produced chickens in F1 all with slightly frizzled feathers. Here are the observed counts in F2, by phenotype: The most likely genetic model is that of a single gene locus with two codominant alleles producing a 1:2:1 ratio in F2. Are the data consistent with such a model? H0: pF = 1/4; pSF = 2/4; pS = 1/4 Ha: H0 is not true Test Contribution Category Observed Proportion Expected to Chi-Sq F 23 0.25 23.25 0.002688 SF 50 0.50 46.50 0.263441 S 20 0.25 23.25 0.454301 N DF Chi-Sq P-Value 93 2 0.720430 0.698

Are the data consistent with such a model? The most likely genetic model is that of a single gene locus with two codominant alleles producing a 1:2:1 ratio in F2. Are the data consistent with such a model? H0: pF = 1/4; pSF = 2/4; pS = 1/4 Ha: H0 is not true N DF Chi-Sq P-Value 93 2 0.720430 0.698 Degrees of freedom = k – 1 = 2, and X2 = 0.72, P > 0.25 (Table D). Software gives P = 0.698. This is not statistically significant and we fail to reject H0. The observed data are consistent with a single gene locus with two codominant alleles (1:2:1 genetic model). The small observed deviations from the model could simply have arisen from the random sampling process alone. Failing to reject the null hypothesis is not proof that the null hypothesis is true, just that it is one possibility.