Presentation is loading. Please wait.

Presentation is loading. Please wait.

+ Chapter 11 Inference for Distributions of Categorical Data 11.1Chi-Square Goodness-of-Fit Tests 11.2Inference for Relationships.

Similar presentations


Presentation on theme: "+ Chapter 11 Inference for Distributions of Categorical Data 11.1Chi-Square Goodness-of-Fit Tests 11.2Inference for Relationships."— Presentation transcript:

1 + Chapter 11 Inference for Distributions of Categorical Data 11.1Chi-Square Goodness-of-Fit Tests 11.2Inference for Relationships

2 + Chi-Square Goodness-of-Fit Tests Introduction In the previous chapter, we discussed inference procedures for comparing the proportion of successes for two populations ortreatments. Sometimes we want to examine the distribution of asingle categorical variable in a population. The chi-square goodness-of-fit test allows us to determine whether a hypothesized distribution seems valid. We can decide whether the distribution of a categorical variable differs for two or more populations or treatments using a chi- square test for homogeneity. In doing so, we will often organize our data in a two-way table. It is also possible to use the information in a two-way table to study the relationship between two categorical variables. The chi-square test for association/independence allows us to determine if there is convincing evidence of an association between the variables in the population at large.

3 + The Chi-Square Distributions and P- Values Chi-Square Goodness-of-Fit Tests The chi-square distributions are a family of distributions that take only positive values and are skewed to the right. A particular chi- square distribution is specified by giving its degrees of freedom. The chi-square goodness-of-fit test uses the chi-square distribution with degrees of freedom = the number of categories - 1. The Chi-Square Distributions

4 + The chi-square goodness-of-fit test uses some approximations that become more accurate as we take more observations. Our rule of thumb is that all expected counts must be at least 5. This Large Sample Size condition takes the place of the Normal condition for z and t procedures. To use the chi-square goodness-of-fit test, we must also check that the Random and Independent conditions are met. Conditions: Use the chi-square goodness-of-fit test when Random The data come from a random sample or a randomized experiment. Large Sample Size All expected counts are at least 5. Independent Individual observations are independent. When sampling without replacement, check that the population is at least 10 times as large as the sample (the 10% condition). Carrying Out a Test Chi-Square Goodness-of-Fit Tests Suppose the Random, Large Sample Size, and Independent conditions are met. To determine whether a categorical variable has a specified distribution, expressed as the proportion of individuals falling into each possible category, perform a test of H 0 : The specified distribution of the categorical variable is correct. H a : The specified distribution of the categorical variable is not correct. We can also write these hypotheses symbolically using p i to represent the proportion of individuals that fall in category i: H 0 : p 1 = ___, p 2 = ___, …, p k = ___. H a : At least one of the p i ’s is incorrect. Start by finding the expected count for each category assuming that H 0 is true. Then calculate the chi-square statistic The Chi-Square Goodness-of-Fit Test Before we start using the chi-square goodness- of-fit test, we have two important cautions to offer. 1. The chi-square test statistic compares observed and expected counts. Don’t try to perform calculations with the observed and expected proportions in each category. 2. When checking the Large Sample Size condition, be sure to examine the expected counts, not the observed counts.

5 + Example: When Were You Born? Are births evenly distributed across the days of the week? The one-way table below shows the distribution of births across the days of the week in a random sample of 140 births from localrecords in a large city. Do these data give significant evidence that local births are not equallylikely on all days of the week? Chi-Square Goodness-of-Fit Tests State: We want to perform a test of H 0 : Birth days in this local area are evenly distributed across the days of the week. H a : Birth days in this local area are not evenly distributed across the days of the week. The null hypothesis says that the proportions of births are the same on all days. In that case, all 7 proportions must be 1/7. So we could also write the hypotheses as H 0 : p Sun = p Mon = p Tues =... = p Sat = 1/7. H a : At least one of the proportions is not 1/7. We will use α = 0.05. DaySunMonTueWedThuFriSat Births13232420271815 Plan: If the conditions are met, we should conduct a chi-square goodness-of-fit test. Random The data came from a random sample of local births. Large Sample Size Assuming H 0 is true, we would expect one-seventh of the births to occur on each day of the week. For the sample of 140 births, the expected count for all 7 days would be 1/7(140) = 20 births. Since 20 ≥ 5, this condition is met. Independent Individual births in the random sample should occur independently (assuming no twins). Because we are sampling without replacement, there need to be at least 10(140) = 1400 births in the local area. This should be the case in a large city.

6 + Example: When Were You Born? Chi-Square Goodness-of-Fit Tests Do: Since the conditions are satisfied, we can perform a chi-square goodness-of- fit test. We begin by calculating the test statistic. P-Value: Using Table C: χ 2 = 7.60 is less than the smallest entry in the df = 6 row, which corresponds to tail area 0.25. The P-value is therefore greater than 0.25. Using technology: We can find the exact P- value with a calculator: χ 2 cdf(7.60,1000,6) = 0.269. Conclude: Because the P-value, 0.269, is greater than α = 0.05, we fail to reject H 0. These 140 births don’t provide enough evidence to say that all local births in this area are not evenly distributed across the days of the week.

7 + Example: Inherited Traits Biologists wish to cross pairs of tobacco plants having genetic makeup Gg, indicating that each plant has one dominant gene (G) and one recessive gene (g) for color. Each offspring plantwill receive one gene for color from each parent. Chi-Square Goodness-of-Fit Tests The Punnett square suggests that the expected ratio of green (GG) to yellow-green (Gg) to albino (gg) tobacco plants should be 1:2:1. In other words, the biologists predict that 25% of the offspring will be green, 50% will be yellow-green, and 25% will be albino. To test their hypothesis about the distribution of offspring, the biologists mate 84 randomly selected pairs of yellow-green parent plants. Of 84 offspring, 23 plants were green, 50 were yellow-green, and 11 were albino. Do these data differ significantly from what the biologists have predicted? Carry out an appropriate test at the α = 0.05 level to help answer this question.

8 + Example: Inherited Traits Chi-Square Goodness-of-Fit Tests State: We want to perform a test of H 0 : The biologists’ predicted color distribution for tobacco plant offspring is correct. That is, p green = 0.25, p yellow-green = 0.5, p albino = 0.25 H a : The biologists’ predicted color distribution isn’t correct. That is, at least one of the stated proportions is incorrect. We will use α = 0.05. Plan: If the conditions are met, we should conduct a chi-square goodness-of-fit test. Random The data came from a random sample of local births. Large Sample Size We check that all expected counts are at least 5. Assuming H 0 is true, the expected counts for the different colors of offspring are green: (0.25)(84) = 21; yellow-green: (0.50)(84) = 42; albino: (0.25)(84) = 21 The complete table of observed and expected counts is shown below. Independent Individual offspring inherit their traits independently from one another. Since we are sampling without replacement, there would need to be at least 10(84) = 840 tobacco plants in the population. This seems reasonable to believe.

9 + Example: Inherited Traits Chi-Square Goodness-of-Fit Tests Do: Since the conditions are satisfied, we can perform a chi-square goodness-of- fit test. We begin by calculating the test statistic. Conclude: Because the P-value, 0.0392, is less than α = 0.05, we will reject H 0. We have convincing evidence that the biologists’ hypothesized distribution for the color of tobacco plant offspring is incorrect. P-Value: Note that df = number of categories - 1 = 3 - 1 = 2. Using df = 2, the P-value from the calculator is 0.0392

10 + Follow-up Analysis Chi-Square Goodness-of-Fit Tests In the chi-square goodness-of-fit test, we test the null hypothesis that a categorical variable has a specified distribution. If the sample data lead to a statistically significant result, we can conclude that our variable has a distribution different from the specified one. When this happens, start by examining which categories of the variable show large deviations between the observed and expected counts. Then look at the individual terms that are added together to produce the test statistic χ 2. These components show which terms contribute most to the chi-square statistic.

11 + The Chi-Square Test for Homogeneity Inference for Relationships When the Random, Large Sample Size, and Independent conditions are met, the χ 2 statistic calculated from a two-way table can be used to perform a test of H 0 : There is no difference in the distribution of a categorical variable for several populations or treatments. P-values for this test come from a chi-square distribution with df = (number of rows - 1)(number of columns - 1). This new procedure is known as a chi-square test for homogeneity. Suppose the Random, Large Sample Size, and Independent conditions are met. You can use the chi-square test for homogeneity to test H 0 : There is no difference in the distribution of a categorical variable for several populations or treatments. H a : There is a difference in the distribution of a categorical variable for several populations or treatments. Start by finding the expected counts. Then calculate the chi-square statistic where the sum is over all cells (not including totals) in the two-way table. If H 0 is true, the χ 2 statistic has approximately a chi-square distribution with degrees of freedom = (number of rows – 1) (number of columns - 1). The P- value is the area to the right of χ 2 under the corresponding chi-square density curve. Chi-Square Test for Homogeneity

12 + Example: Cell-Only Telephone Users Inference for Relationships State: We want to perform a test of H 0 : There is no difference in the distribution of party affiliation in the cell-only and landline populations. H a : There is a difference in the distribution of party affiliation in the cell-only and landline populations. We will use α = 0.05. Random digit dialing telephone surveys used to exclude cell phone numbers. If the opinions of people who have only cell phones differ from those of people who have landline service, the poll results may not represent the entire adult population. The Pew Research Center interviewed separate random samples of cell-only and landline telephone users who were less than 30 years old. Here’s what the Pew survey found about how these people describe their political party affiliation.

13 + Example: Cell-Only Telephone Users Inference for Relationships Plan: If the conditions are met, we should conduct a chi-square test for homogeneity. Random The data came from separate random samples of 96 cell-only and 104 landline users. Large Sample Size Make sure the expected counts are ≥ 5. We will do by hand and by technology. The matrix below shows the expected counts: Independent Researchers took independent samples of cell-only and landline phone users. Sampling without replacement was used, so there need to be at least 10(96) = 960 cell-only users under age 30 and at least 10(104) = 1040 landline users under age 30. This is safe to assume.

14 + Example: Cell-Only Telephone Users Inference for Relationships Do: Since the conditions are satisfied, we can a perform chi-test for homogeneity. We begin by calculating the test statistic. Conclude: Because the P-value, 0.20, is greater than α = 0.05, we fail to reject H 0. There is not enough evidence to conclude that the distribution of party affiliation differs in the cell-only and landline user populations. P-Value: Using df = (3 – 1)(2 – 1) = 2, the P-value is 0.20.

15 + Comparing Several Proportions Inference for Relationships Many studies involve comparing the proportion of successes for each of several populations or treatments. The two-sample z test from Chapter 10 allows us to test the null hypothesis H 0 : p 1 = p 2, where p 1 and p 2 are the actual proportions of successes for the two populations or treatments. The chi-square test for homogeneity allows us to test H 0 : p 1 = p 2 = …= p k. This null hypothesis says that there is no difference in the proportions of successes for the k populations or treatments. The alternative hypothesis is H a : at least two of the p i ’s are different. Caution: Many students incorrectly state H a as “all the proportions are different.” Think about it this way: the opposite of “all the proportions are equal” is “some of the proportions are not equal.”

16 + Example: Cocaine Addiction is Hard to Break Inference for Relationships State: We want to perform a test of H 0 : p 1 = p 2 = p 3 there is no difference in the relapse rate for the three treatments. H a : at least two of the p i ’s there is a difference in the relapse rate for are different the three treatments. where p i = the actual proportion of chronic cocaine users like the ones in this experiment who would relapse under treatment i. We will use α = 0.01. Cocaine addicts need cocaine to feel any pleasure, so perhaps giving them an antidepressant drug will help. A three-year study with 72 chronic cocaine users compared an antidepressant drug called desipramine with lithium (a standard drug to treat cocaine addiction) and a placebo. One-third of the subjects were randomly assigned to receive each treatment. Here are the results:

17 + Example: Cocaine Addiction is Hard to Break Inference for Relationships Plan: If the conditions are met, we should conduct a chi-square test for homogeneity. Random The subjects were randomly assigned to the treatment groups. Large Sample Size We can calculate the expected counts from the two-way table assuming H 0 is true. All the expected counts are ≥5 so the condition is met. Independent The random assignment helps create three independent groups. If the experiment is conducted properly, then knowing one subject’s relapse status should give us no information about another subject’s outcome. So individual observations are independent.

18 + Example: Cocaine Addiction is Hard to Break Inference for Relationships Do: Since the conditions are satisfied, we can a perform chi-test for homogeneity. We begin by calculating the test statistic. Conclude: Because the P-value, 0.0052, is less than α = 0.01, we reject H 0. We have sufficient evidence to conclude that the true relapse rates for the three treatments are not all the same. P-Value: Using df = (3 – 1)(2 – 1) = 2, the calculator give a P-value of 0.0052.


Download ppt "+ Chapter 11 Inference for Distributions of Categorical Data 11.1Chi-Square Goodness-of-Fit Tests 11.2Inference for Relationships."

Similar presentations


Ads by Google