11.2 Inference for Two-Way Tables Objectives SWBAT: COMPARE conditional distributions for data in a two-way table. STATE appropriate hypotheses and COMPUTE.

Slides:



Advertisements
Similar presentations
CHAPTER 23: Two Categorical Variables: The Chi-Square Test
Advertisements

CHAPTER 23: Two Categorical Variables The Chi-Square Test ESSENTIAL STATISTICS Second Edition David S. Moore, William I. Notz, and Michael A. Fligner Lecture.
Chapter 11 Inference for Distributions of Categorical Data
Chapter 13: Inference for Tables
AP Statistics Section 14.2 A. The two-sample z procedures of chapter 13 allowed us to compare the proportions of successes in two groups (either two populations.
Does Background Music Influence What Customers Buy?
Chapter 11 Inference for Distributions of Categorical Data
Chapter 13: Inference for Distributions of Categorical Data
1-1 Copyright © 2015, 2010, 2007 Pearson Education, Inc. Chapter 25, Slide 1 Chapter 25 Comparing Counts.
CHAPTER 11 Inference for Distributions of Categorical Data
CHAPTER 11 Inference for Distributions of Categorical Data
+ The Practice of Statistics, 4 th edition – For AP* STARNES, YATES, MOORE Chapter 11: Inference for Distributions of Categorical Data Section 11.2 Inference.
Lesson Inference for Two-Way Tables. Vocabulary Statistical Inference – provides methods for drawing conclusions about a population parameter from.
Chapter 11: Inference for Distributions of Categorical Data Section 11.2 Inference for Relationships.
Chapter 13: Inference for Tables – Chi-Square Procedures
AP Statistics Section 14.2 A. The two-sample z procedures of chapter 13 allowed us to compare the proportions of successes in two groups (either two populations.
Lecture Presentation Slides SEVENTH EDITION STATISTICS Moore / McCabe / Craig Introduction to the Practice of Chapter 9 Analysis of Two-Way Tables.
Copyright © 2012 Pearson Education. All rights reserved Copyright © 2012 Pearson Education. All rights reserved. Chapter 15 Inference for Counts:
11.2 Inference for Relationships. Section 11.2 Inference for Relationships COMPUTE expected counts, conditional distributions, and contributions to the.
Chapter 11: Inference for Distributions of Categorical Data.
Chapter 11: Inference for Distributions of Categorical Data
The Practice of Statistics, 5th Edition Starnes, Tabor, Yates, Moore Bedford Freeman Worth Publishers CHAPTER 11 Inference for Distributions of Categorical.
Chapter 11: Inference for Distributions of Categorical Data Section 11.1 Chi-Square Goodness-of-Fit Tests.
CHAPTER 11 SECTION 2 Inference for Relationships.
Chapter 11 The Chi-Square Test of Association/Independence Target Goal: I can perform a chi-square test for association/independence to determine whether.
13.2 Chi-Square Test for Homogeneity & Independence AP Statistics.
+ Chi Square Test Homogeneity or Independence( Association)
BPS - 5th Ed. Chapter 221 Two Categorical Variables: The Chi-Square Test.
+ The Practice of Statistics, 4 th edition – For AP* STARNES, YATES, MOORE Chapter 11: Inference for Distributions of Categorical Data Section 11.2 Inference.
CHAPTER 23: Two Categorical Variables The Chi-Square Test ESSENTIAL STATISTICS Second Edition David S. Moore, William I. Notz, and Michael A. Fligner Lecture.
Copyright © 2010 Pearson Education, Inc. Slide
+ Chapter 11 Inference for Distributions of Categorical Data 11.1Chi-Square Goodness-of-Fit Tests 11.2Inference for Relationships.
Lesson Inference for Two-Way Tables. Knowledge Objectives Explain what is mean by a two-way table. Define the chi-square (χ 2 ) statistic. Identify.
Lecture PowerPoint Slides Basic Practice of Statistics 7 th Edition.
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.
The Practice of Statistics, 5th Edition Starnes, Tabor, Yates, Moore Bedford Freeman Worth Publishers CHAPTER 11 Inference for Distributions of Categorical.
11.1 Chi-Square Tests for Goodness of Fit Objectives SWBAT: STATE appropriate hypotheses and COMPUTE expected counts for a chi- square test for goodness.
Chapter 14 Inference for Distribution of Categorical Variables: Chi-Squared Procedures.
CHAPTER 11: INFERENCE FOR DISTRIBUTIONS OF CATEGORICAL DATA 11.1 CHI-SQUARE TESTS FOR GOODNESS OF FIT OUTCOME: I WILL STATE APPROPRIATE HYPOTHESES AND.
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 &
Chi Square Procedures Chapter 14. Chi-Square Goodness-of-Fit Tests Section 14.1.
AP Stats Check In Where we’ve been… Chapter 7…Chapter 8… Where we are going… Significance Tests!! –Ch 9 Tests about a population proportion –Ch 9Tests.
Textbook Section * We already know how to compare two proportions for two populations/groups. * What if we want to compare the distributions of.
 Check the Random, Large Sample Size and Independent conditions before performing a chi-square test  Use a chi-square test for homogeneity to determine.
Chi Square Test of Homogeneity. Are the different types of M&M’s distributed the same across the different colors? PlainPeanutPeanut Butter Crispy Brown7447.
11.1 Chi-Square Tests for Goodness of Fit
Chapter 11: Inference for Distributions of Categorical Data
CHAPTER 11 Inference for Distributions of Categorical Data
Vocabulary Statistical Inference – provides methods for drawing conclusions about a population parameter from sample data Expected Values– row total *
Introduction The two-sample z procedures of Chapter 10 allow us to compare the proportions of successes in two populations or for two treatments. What.
CHAPTER 11 Inference for Distributions of Categorical Data
AP Stats Check In Where we’ve been… Chapter 7…Chapter 8…
Inference for Relationships
AP Stats Check In Where we’ve been… Chapter 7…Chapter 8…
Chapter 11: Inference for Distributions of Categorical Data
CHAPTER 11 Inference for Distributions of Categorical Data
Inference for Relationships
CHAPTER 11 Inference for Distributions of Categorical Data
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
11.2 Inference for Relationships
CHAPTER 11 Inference for Distributions of Categorical Data
CHAPTER 11 Inference for Distributions of Categorical Data
Presentation transcript:

11.2 Inference for Two-Way Tables Objectives SWBAT: COMPARE conditional distributions for data in a two-way table. STATE appropriate hypotheses and COMPUTE expected counts for a chi-square test based on data in a two-way table. CALCULATE the chi-square statistic, degrees of freedom, and p-value for a chi-square test based on data in a two-way table. PERFORM a chi-square test for homogeneity. PERFORM a chi-square test for independence. CHOOSE the appropriate chi-square test.

How is section 11.2 different from section 11.1? Section 11.1 examined the distribution of a categorical variable in one population to a hypothesized distribution. Section 11.2 compares the distribution of a categorical variable in 2 or more populations or treatments. For example: comparing the color distributions of plain and peanut M&M’s Comparing car makes in Michigan and California Section 11.2 presents the data in a two-way table (as opposed to 11.1 which used a one-way table).

Does Background Music Influence What Customers Buy? Market researchers suspect that background music may affect the mood and buying behavior of customers. One study in a Mediterranean restaurant compared three randomly assigned treatments: no music, French accordion music, and Italian string music. Under each condition, the researchers recorded the numbers of customers who ordered French, Italian, and other entrees. What are the two explanations for the differences in the distributions of entrée purchases? 1)Music has an effect on purchases 2)Music has no effect and the differences are due to the chance variation in the random assignment

How do you state hypotheses for a test of homogeneity? A chi-square test for homogeneity is a test to determine whether the distribution of a categorical variable is the same for each of several populations or treatments. A chi-square test for homogeneity begins with the hypotheses: 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. We compare the observed counts in a two-way table with the counts we would expect if H 0 were true. For the entrée example: H 0 : There is no difference in the true distributions of entrees ordered at this restaurant when no music, French accordion music, or Italian string music is played. H a : There is a difference in the true distributions of entrees ordered at this restaurant when no music, French accordion music, or Italian string music is played.

What is the problem of multiple comparisons? What strategy should we use to deal with it? The problem of how to do many comparisons at once with an overall measure of confidence in all our conclusions is common in statistics. This is the problem of multiple comparisons. Statistical methods for dealing with multiple comparisons usually have two parts: 1) An overall test to see if there is good evidence of any differences among the parameters that we want to compare. 2) A detailed follow-up analysis to decide which of the parameters differ and to estimate how large the differences are. The overall test uses the chi-square statistic and distributions. We tests to compare the distribution of a categorical variable for several populations or treatments.

How do you calculate the expected counts for a test that compares the distribution of a categorical variable in multiple groups or populations? Assuming that the null is true, the proportion in each category should be the same in each population or group. Finding Expected Counts When H 0 is true, the expected count in any cell of a two-way table is Reminder: Don’t round!

Let’s go back to the entrée example. Calculate the expected counts. French entrees ordered when no music is playing: French entrees French music: French entrees Italian music: Italian entrée No music: Italian entrée French music: Italian entrée Italian music: Other entrée No music:French music: Other entrée Italian music:

What are the conditions for a test of homogeneity? Conditions for Performing a Chi-Square Test for Homogeneity Random: The data come a well-designed random sample or from a randomized experiment. o 10%: When sampling without replacement, check that n ≤ (1/10)N. Large Counts: All expected counts are greater than 5 What is the formula for the chi-square test statistic? Is it on the formula sheet? What does it measure? Yes formula sheet. It measures how much the observed values differ from the expected values. This time, the sum is over all cells (not including the totals!) in the two-way table.

With the entrée example:

How can you calculate the degrees of freedom for a chi-square test for homogeneity? df = (number of rows – 1)(number of columns – 1) The entrée example would have df (3 – 1)(3 – 1) = (2)(2)=4 The p-value for the entrée example:

Has modern technology changed the distribution of birthdays? With more babies being delivered by planned c-section, a statistics class hypothesized that the day-of-the-week distribution for births would be different for people born after 1993 compared to people born before To investigate, they selected a random sample of people from each both age categories and recorded the day of the week on which they were born. The results are shown in the table. Is there convincing evidence that the distribution of birth days has changed? a) Calculate the conditional distribution (in proportions) of the birth day for older people and younger people. b) Make an appropriate graph for part (a).

c) Write a few sentences comparing the distributions for birthdays for each age group. There were a higher proportion of older people born on Tuesday, Saturday, and Sunday and a much higher proportion of younger people born on Thursday. The proportions are similar for Monday, Wednesday, and Friday. This supports the idea that doctors plan c-sections for convenient times. There was a smaller proportion of young people born on the weekend and a much bigger proportion born on Thursday, possibly to avoid having their mothers go into labor on the weekend. Has modern technology changed the distribution of birthdays? With more babies being delivered by planned c-section, a statistics class hypothesized that the day-of-the-week distribution for births would be different for people born after 1993 compared to people born before To investigate, they selected a random sample of people from each both age categories and recorded the day of the week on which they were born. The results are shown in the table. Is there convincing evidence that the distribution of birth days has changed?

d) State the hypotheses. Has modern technology changed the distribution of birthdays? With more babies being delivered by planned c-section, a statistics class hypothesized that the day-of-the-week distribution for births would be different for people born after 1993 compared to people born before To investigate, they selected a random sample of people from each both age categories and recorded the day of the week on which they were born. The results are shown in the table. Is there convincing evidence that the distribution of birth days has changed? e) Verify that the conditions are met. Random: The data came from two independent random samples. 10%: 77 is less than 10% of all people born before 1980 and 73 is less than 10% of all people born after Large Counts: The expected counts are all at least 5 (the smallest is 8.25). (see next slide)

Has modern technology changed the distribution of birthdays? With more babies being delivered by planned c-section, a statistics class hypothesized that the day-of-the-week distribution for births would be different for people born after 1993 compared to people born before To investigate, they selected a random sample of people from each both age categories and recorded the day of the week on which they were born. The results are shown in the table. Is there convincing evidence that the distribution of birth days has changed? f) Calculate the expected counts, chi-square statistic, and p-value. Sunday 1980 Sunday 1993 Monday 1980 Monday 1993 df = (2-1)(7-1) = 6

Has modern technology changed the distribution of birthdays? With more babies being delivered by planned c-section, a statistics class hypothesized that the day-of-the-week distribution for births would be different for people born after 1993 compared to people born before To investigate, they selected a random sample of people from each both age categories and recorded the day of the week on which they were born. The results are shown in the table. Is there convincing evidence that the distribution of birth days has changed?

On the calculator: 2 nd > MATRIX > Edit > A Change the dimensions to 7 X 2 Enter the observed counts. Do the same for B and enter the expected counts. Can you use your calculator to do a chi-square test for homogeneity? See above!

Inspired by the Does Background Music Influence What Customers Buy? example, a statistics student decided to investigate other ways to influence a person’s behavior. Using 60 volunteers she randomly assigned 20 volunteers to get the “red” survey, 20 volunteers to get the “blue” survey, and 20 volunteers to get a control survey. The first three questions on each survey were the same, but the fourth and fifth questions were different. For example, the fourth question on the “red” survey was “When you think of the color red, what do you think about?” On the blue survey, the question replaced red with blue. On the control survey, the questions were not about color. As a reward, the student let each volunteer choose a chocolate candy in a red wrapper or a chocolate candy in a blue wrapper. Here are the results.

Plan: If conditions are met, we will perform a chi-square test for homogeneity. Random: The three treatments were assigned at random. 10%: Because we are not sampling without replacement, we do not need the 10% check. Large Counts: The expected counts are all at least 5.

Inspired by the Does Background Music Influence What Customers Buy? example, a statistics student decided to investigate other ways to influence a person’s behavior. Using 60 volunteers she randomly assigned 20 volunteers to get the “red” survey, 20 volunteers to get the “blue” survey, and 20 volunteers to get a control survey. The first three questions on each survey were the same, but the fourth and fifth questions were different. For example, the fourth question on the “red” survey was “When you think of the color red, what do you think about?” On the blue survey, the question replaced red with blue. On the control survey, the questions were not about color. As a reward, the student let each volunteer choose a chocolate candy in a red wrapper or a chocolate candy in a blue wrapper. Here are the results. Do: df = (3-1)(2-1) =2

Inspired by the Does Background Music Influence What Customers Buy? example, a statistics student decided to investigate other ways to influence a person’s behavior. Using 60 volunteers she randomly assigned 20 volunteers to get the “red” survey, 20 volunteers to get the “blue” survey, and 20 volunteers to get a control survey. The first three questions on each survey were the same, but the fourth and fifth questions were different. For example, the fourth question on the “red” survey was “When you think of the color red, what do you think about?” On the blue survey, the question replaced red with blue. On the control survey, the questions were not about color. As a reward, the student let each volunteer choose a chocolate candy in a red wrapper or a chocolate candy in a blue wrapper. Here are the results.

How do you conduct a follow-up analysis for a test of homogeneity? When should you do this? The chi-square test for homogeneity allows us to compare the distribution of a categorical variable for any number of populations or treatments. If the test allows us to reject the null hypothesis of no difference, we then want to do a follow-up analysis that examines the differences in detail. Start by examining which cells in the two-way table show large deviations between the observed and expected counts. Then look at the individual components to see which terms contribute most to the chi-square statistic.

Do a follow-up analysis for the candy example. Looking at the output, we can see that 1 of the components that make up the chi-square statistic contribute 2.17 (about 33%) of the total We can say that red candy choices are strongly affected by red surveys.

What does it mean if two variables have an association? What does it mean if two variables are independent? Two variables have an association if knowing the value of one variable helps predict the value of another variable (think back to Chapter 3). Two variables are independent if one does not affect the other (knowing the value of one does not help you predict the value of the other, or the occurrence of one has no affect on the occurrence of the other).

How is a test of independence different than a test of homogeneity? A chi-square test for homogeneity is a test to determine whether the distribution of a categorical variable is the same for each of several populations or treatments. A chi-square test for independence is to determine if there is an association between two categorical variables in the same population. A single random sample of individuals is chosen from a single population and then classified based on two categorical variables. It’s all about the way the data is gathered. If there is one sample and two variables, we testing for an association. If there are 2+ samples or groups and one variable, we are testing for homogeneity. Think about the homogeneity examples we’ve done: The entrée example: 3 groups (no music, French music, Italian music) 1 variable (type of entrée) The survey example: 3 groups (blue, red, control) 1 variable (color of candy chosen) The birthday example: 2 groups (1980 and 1993) 1 variable (birth day)

How do you state hypotheses for a test of independence? H 0 : There is no association between two categorical variables in the population of interest. H a : There is an association between two categorical variables in the population of interest. Or H 0 : Two categorical variables are independent in the population of interest. H a : Two categorical variables are not independent in the population of interest.

How do you calculate the expected counts for a test of independence? The test statistic? The df? Everything is the same as in the test for homogeneity: df = (number of rows – 1)(number of columns – 1) Reminder: Don’t round.

What are the conditions for a test of association/independence? Conditions for Performing a Chi-Square Test for Independence Random: The data come a well-designed random sample or from a randomized experiment. o 10%: When sampling without replacement, check that n ≤ (1/10)N. Large Counts: All expected counts are greater than 5

Alternate Example: Finger Length Is your index finger longer than your ring finger? Does this depend on your gender? A random sample of 460 HS students in the U.S. was selected and asked to record if their pointer finger was longer than, shorter than, or the same length as their ring finger on their left hand. The gender of each student was also reported. The data are summarized in the table. a) Make a graph to investigate the relationship between gender and relative finger length. Describe what you see. A higher proportion of females had longer index fingers compared to males while a higher proportion of males had longer ring fingers. A similar proportion of females and males had index fingers and ring fingers of the same length.

Alternate Example: Finger Length Is your index finger longer than your ring finger? Does this depend on your gender? A random sample of 460 HS students in the U.S. was selected and asked to record if their pointer finger was longer than, shorter than, or the same length as their ring finger on their left hand. The gender of each student was also reported. The data are summarized in the table. b) Do these data provide convincing evidence at the 5% level of significance of an association between gender and relative finger length for HS students in the US? Or the null could have been gender and relative finger length are independent in the population of US HS students, with the alternative being gender and relative finger length are not independent in the population of US HS students.

Alternate Example: Finger Length Is your index finger longer than your ring finger? Does this depend on your gender? A random sample of 460 HS students in the U.S. was selected and asked to record if their pointer finger was longer than, shorter than, or the same length as their ring finger on their left hand. The gender of each student was also reported. The data are summarized in the table. Plan: If conditions are met, we will perform a chi-square test for independence. Random: The sample was randomly selected. 10%: The sample of 460 students is less than 10% of all U.S. HS students. Large Counts: The expected counts are all at least 5. See the table

Alternate Example: Finger Length Is your index finger longer than your ring finger? Does this depend on your gender? A random sample of 460 HS students in the U.S. was selected and asked to record if their pointer finger was longer than, shorter than, or the same length as their ring finger on their left hand. The gender of each student was also reported. The data are summarized in the table. Do: df = (2-1)(3-1)=2

Conclude: Because the p-value of is greater than alpha of 0.05, we fail to reject the null. We do not have convincing evidence that there is an association between gender and relative finger length in the population of U.S. high school students. c) If you conclusion was an error, which type of error did you commit? Explain. A type II error. We did not think there was an association between gender and relative finger length in the population of U.S. high school students, when in reality there was an association. Alternate Example: Finger Length Is your index finger longer than your ring finger? Does this depend on your gender? A random sample of 460 HS students in the U.S. was selected and asked to record if their pointer finger was longer than, shorter than, or the same length as their ring finger on their left hand. The gender of each student was also reported. The data are summarized in the table. Note: The calculator command is the same as the test for homogeneity.

An article in the Arizona Daily Star (April 9, 2009) included the following table. Suppose that you decide to analyze these data using a chi-square test. However, without any additional information about how the data were collected, it isn’t possible to know which chi-square test is appropriate. a) Explain why it is okay to use age as a categorical variable rather than a quantitative variable. It is okay because the quantitative variables were put into categories (note: when doing so, some info might be lost) b) Explain how you know that a goodness-of-fit test is not appropriate for analyzing these data. Since there are either two variables or two or more populations, a goodness-of-fit test is not appropriate. Goodness-of-fit tests are appropriate only when analyzing the distribution of one variable in one population (think one-way table).

c) Describe how these data could have been collected so that a test for homogeneity is appropriate. To make a test for homogeneity appropriate, we would need to take six independent random samples, one from each age category, and then ask every person whether or not they use online social networks. Or we could take two independent random samples, one of online social network users and one of people who do not use online social networks, and ask every member of each sample how old they are. An article in the Arizona Daily Star (April 9, 2009) included the following table. Suppose that you decide to analyze these data using a chi-square test. However, without any additional information about how the data were collected, it isn’t possible to know which chi-square test is appropriate.

d) Describe how these data could have been collected so that a test for independence is appropriate. To make a test for association/independence appropriate, we would take one random sample from the population and ask every member about their age and whether or not they use online social networks. This seems like the most reasonable method for collecting the data, so a test of association/independence is probably the best choice. But we can’t know for sure unless we know how the data were collected. An article in the Arizona Daily Star (April 9, 2009) included the following table. Suppose that you decide to analyze these data using a chi-square test. However, without any additional information about how the data were collected, it isn’t possible to know which chi-square test is appropriate.

Alternate Example: Ibuprofen or acetaminophen? In a study reported by the Annals of Emergency Medicine (March 2009), researchers conducted a randomized, double-blind clinical trial to compare the effects of ibuprofen and acetaminophen plus codeine as a pain reliever for children recovering from arm fractures. There were many response variables recorded, including the presence of any adverse effect, such as nausea, dizziness, and drowsiness. Here are the results: a) Which type of chi-square test is appropriate here? Explain. Homogeneity – two different treatments (ibuprofen and acetaminophen) b) Calculate the chi-square statistic and p-value. df =1

c) Show that the results of a two- sample z test for a difference in proportions are equivalent. Alternate Example: Ibuprofen or acetaminophen? In a study reported by the Annals of Emergency Medicine (March 2009), researchers conducted a randomized, double-blind clinical trial to compare the effects of ibuprofen and acetaminophen plus codeine as a pain reliever for children recovering from arm fractures. There were many response variables recorded, including the presence of any adverse effect, such as nausea, dizziness, and drowsiness. Here are the results:

When should you use a chi-square test and when should you use a two-sample z test? The chi-square test is always two-sided. That is, it only tests for a difference in the two proportions. If you want to test whether one proportion is larger than the other, use the two-sample z test. If you want to estimate the difference between two proportions, use a two- sample z interval. There are no confidence intervals that correspond to chi- square tests. If you are comparing more than two treatments or the response variable has more than two categories, you must use a chi-square test. You can also use a chi-square goodness-of-fit test in place of a one-sample z test for a proportion if the alternative hypothesis is two-sided. The chi-square test will use two categories (success and failure) and have df = 2 – 1 = 1.

How could we compare the distribution of AP Scores at Lyndhurst and Don Bosco? Use a test for homogeneity (two different populations so you can’t use independence). The problem with a two-sample t test is it only compares means, not the entire distribution. What can you do if some of the expected counts are < 5? Combine rows or columns