# M&Ms Two-way Tables Ellen Gundlach STAT 301 Course Coordinator Purdue University.

## Presentation on theme: "M&Ms Two-way Tables Ellen Gundlach STAT 301 Course Coordinator Purdue University."— Presentation transcript:

M&Ms Two-way Tables Ellen Gundlach STAT 301 Course Coordinator Purdue University

M&Ms Color Distribution % according to their website BrownYellowRedBlueOrangeGreen Plain 131413242016 Peanut 12151223 15 Peanut Butter/ Almond 10201020

Skittles Color Distribution % according to their hotline RedOrangeYellowGreenPurple Skittles20

My M&Ms data in counts BrownYellowRedBlueOrangeGreenTotal Plain 1410 84854 Peanut 23508422 Total 161315812 76

My M&Ms data: joint % (divide counts by total = 76) BrownYellowRedBlueOrangeGreen Plain 18.413.2 10.55.310.5 Peanut 2.63.96.6010.55.3

My M&Ms data: marginal %s for color (add down the columns) BrownYellowRedBlueOrangeGreenTotal Plain 18.413.2 10.55.310.5 Peanut 2.63.96.6010.55.3 Marg. for color 21.017.119.810.515.8 100

My M&Ms data: marginal %s for flavor (add across the rows) BrownYellowRedBlueOrangeGreenMarg. for flavor Plain 18.413.2 10.55.310.571.1 Peanut 2.63.96.6010.55.328.9 Total 100

My M&Ms data: joint and marginal %s BrownYellowRedBlueOrangeGreenMarg. for flavor Plain 18.413.2 10.55.310.571.1 Peanut 2.63.96.6010.55.328.9 Marg. for color 21.017.119.810.515.8 100

Conditional distribution of flavor for color We know the color of our M&M already, but now how is flavor distributed for this color?

Conditional distribution example We know we have a red M&M, so what is the probability it is a plain M&M?

Conditional distribution of color for flavor We know the flavor of our M&M already, but now how is color distributed for this color?

Conditional distribution example We know we have a peanut M&M, so what is the probability it is green?

Conditional distributions in general Conditional distribution of X for Y (we know Y for sure already, but we want to know the probability or % of having X be true as well):

Bar graphs for conditional distribution of color for both flavors

Chi-squared hypothesis test H 0 : There is no association between color distribution and flavor for M&Ms. H a : There is association between color distribution and flavor for M&Ms. Use an  = 0.01 for this story.

Full-class M&Ms data in counts (large sample size necessary for test) BrownYellowRedBlueOrangeGreen Plain 147302264407330373 Peanut 6911070162148123

Chi-squared test SPSS results

Chi-squared test conclusions Test statistic = 14.396 and P-value = 0.013 Since P-value is > our  of 0.01, we do not reject H 0. We do not have enough evidence to say there is association between color distribution and flavor for M&Ms.

Skittles vs. M&Ms Now we will compare the proportion of yellow candies for Skittles and for M&Ms. The previous two-way table with plain and peanut M&Ms was of size 2 x 6. This table will be of size 2x2 because we only care about whether a candy is yellow or non-yellow.

Full-class M&Ms and Skittles data in counts (large sample size necessary for test) YellowNon- Yellow Total Plain M&Ms 30215211823 Skittles 36113511712 Total 66328723535

Chi-squared hypothesis test H 0 : There is no association between color distribution and flavor for these candies. H a : There is association between color distribution and flavor for these candies. Use an  = 0.01 for this story.

Chi-squared test SPSS results

Chi-squared test conclusions Test statistic = 11.839 and P-value = 0.001 Since P-value is < our  of 0.01, we reject H 0. We have evidence that there is association between color distribution and flavor for these candies.

Another way to do this test Since this is a 2x2 table, and if we are only interested in a 2-sided (  ) hypothesis test, we can use the 2-sample proportions test here.

2-sample proportion test hypotheses H 0 : p M&Ms = p Skittles H a : p M&Ms  p Skittles

Defining the proportions

Test statistic

Results from the proportion test Sample proportions: Test statistic Z = -3.44 P-value = 2(0.0003) = 0.0006 Since P-value < our  of 0.01, we reject H 0.

Conclusion to the proportion test We have evidence the proportion of yellow M&Ms is not the same as the proportion of yellow Skittles. In other words, the type of candy makes a difference to the color distribution.

How do our results from the 2 tests compare? The X 2 test statistic = 11.839, which is actually the (Z test statistic = -3.44) 2. If you take into account the rounding, the P- values for both tests are  0.001. We rejected H 0 in both tests.

When do you use which test? Chi-squared tests are best for: two-sided hypothesis tests only 2x2 or bigger tables Proportion (Z) tests are best for: one- or two-sided hypothesis tests only 2x2 tables

Download ppt "M&Ms Two-way Tables Ellen Gundlach STAT 301 Course Coordinator Purdue University."

Similar presentations