Day 38 Page 1 of 3 [1]GOB: Have A37 out for me to check. In your groups do Example 1-A of the Skittles investigation below. Don’t eat any until the end of class! Example 1-A: Mars Incorporated the maker of Skittles claims that 20% of the pieces in each bag are lemon (yellow). Does your bag support their claim? (Show all steps below) [2] Review A37 and D38 Ex 1-A and B [3] Take notes D38 pg.2 Example 1-B: Mars Incorporated the maker of skittles claims that there should be an equal distribution of flavors. Since there are 5 flavors in each package, each flavor should represent ___ % of the total bag. Does your bag support their claim? (Show all steps below) H0: The distribution of candy colors is as the manufacturer claimed; uniform (all occur with frequency 1/5). HA: The distribution is not what the manufacturer claims it to be. A0 Data are counts. C0 (Are they?) A1 Individuals/data independent. C1 SRS and n < 10% population. A2 Sample large enough C2 All expected counts ≥ 5. We have categorical data (counts). We have a random sample of Skittles (we think) and 59 < 10% of all candies. We expect 11.8 ≥ 5 of each color to be in the bag. Because the conditions are satisfied I’ll use a χ2 model with 5 – 1 = 4 degrees of freedom and do a chi-square goodness-of-fit test. Flavor/Color Lime/Green Grape/Purple Lemon/Yellow Orange/Orange Strawberry/Red Sum Observed Counts 11 16 11 11 10 59 degrees freedom (# of cells - 1) 4 Expected Values (#obs.*hyp.prop.) 11.8 11.8 11.8 11.8 11.8 Residuals (Obs - Exp) -0.8 4.2 -0.8 -0.8 -1.8 The P-Value of 0.75 says that if the Skittle colors were uniformly distributed, an observed chi-square value of 1.932 or higher would occur about 75% of the time. This certainly isn’t unusual so I fail to reject the null hypothesis, and conclude that these data do not show evidence of nonuniform distribution of Skittle colors. (Residuals)2 (Obs - Exp)2 0.64 17.64 0.64 0.64 3.24 Component (Obs - Exp)2/Exp 0.054 1.495 0.054 0.054 0.275 1.932 = χ2 Day 38 Page 2 of 3 [3] In Example 1-A we are only interested if a candy is yellow (Success) or not yellow (Failure). Since we are working with only one proportion, yellow, we can use a one-proportion z-test to investigate if the true proportion of yellow is equal to 1/5. However, in Example 1-B we have 5 hypothesized proportions, one for each color. We need a test that considers all of them together and gives an overall idea of whether the observed distribution differs from the hypothesized one. We have specified a model for the distribution and want to know whether it fits. Hypothesis test only. There is no single parameter to estimate, so a confidence interval wouldn’t make much sense. /* Fill in table while discussing below */ Looks like it’s time for something new. What we have to start with? We have an observed count for each category of the variable from the data, and have an expected count for each category from the hypothesized proportions. We wonder, are the differences just natural sampling variability, or are they so large that they indicate something important? Naturally enough, we look at the differences between these observed and expected counts, denoted (Obs – Exp). We’d like to think about the total of the differences, but just adding them won’t work because some differences are positive, others negative. We’ve been in this predicament before – once when we looked at deviations from the mean to develop standard deviation s (x x ) n 1 2 and again in linear regression when we calculated the observed value – predicted value know as residuals. In fact, these are residuals. They’re just the differences between the observed data and the counts given by the (null) model. We’ll handle these residuals in essentially the same way we did before: We square them. That gives us positive values and focuses attention on any cells with large differences from what we expected. Because the differences between observed and expected counts generally get larger the more data we have, we also need to get an ideal of the relative sizes of the differences. To do that, we divide each squared difference by the expected count for that cell. Now if we sum all these components we get a new test statistic called the chi-square (“ky” as in “sky”): 2 (Obs Exp)2 Exp all cells [4] now complete the table [5] This family of models, like the Student’s t-models, differs only in the number of degrees of freedom. The number of degrees of freedom for a goodness of fit test is n – 1. Here, however, n is not the sample size, but instead is the number of categories. For the Skittles example, we have 5 colors, so our χ2 statistic has 4 degrees of freedom. Look at the chi-square distributions below. Consult with your neighbor and write down as many observations as you can (nu = degrees of freedom): [6] Calculate P-Value with X2cdf( , 999, df) and write the tell part of pg. 1 Ex.1-B Day 38 Page 3 of 3 [7] If the observed counts don’t match the expected, the χ2 statistic will be large. It can’t be “too small.” That would mean that our model really fit the data well. So the chi-square test is always one-sided. If the calculated statistic value is large enough, we’ll reject the null hypothesis. Even though its mechanics work like a one-sided test, the interpretation of a chi-square test is in some sense manysided. With more than two proportions (Success/Failure), there are many ways the null hypothesis can be wrong. By squaring the differences, we made all the deviations positive, whether our observed counts were higher or lower than expected. There’s no direction to the rejection of the null model. All we know is that it doesn’t fit. Some other characteristics of χ2 models: Curves in the χ2 family change both shape and center as the number of degrees of freedom grows. Unlike Normal and t families, χ2 models are skewed right and cannot take on negative values. Unlike Normal and t-models, χ2 models do not measure distances in standard deviation (or standard error) units. With z or t a calculated result of 5 is pretty clearly significant; we can tell even without knowing the P-value, as it’s rare for anything to be five standard deviations from what is anticipated. With the chi-square statistic the picture is murkier. Values that are highly significant when there are a few degrees of freedom fade into non-significance as the curve stretches to the right for greater degrees of freedom. a) Since df = # of categories – 1, larger df are accompanied by more cells in the summation of the χ2 statistic. Thus it takes a much larger value to surprise us when there are more degrees of freedom. b) Look down the column of the χ2 table to see how the critical value increases with higher degrees of freedom. c) Analyzing various χ2 distributions reveals: Mode = df – 2, expected value (mean) = df. Having that initial feel for whether or not the calculated value is unusually large helps make the P-value a little less mysterious. The tables and distributions show a rough guide: unusually large = df * 2 (for df<15) To calculate the exact P-value we just use our calculator: χ2cdf(χ2, 999, df) We use 999 because unlike t and z, chi-square values can get big, especially when there are many cells. Assignment 38: 1) Complete the class notes (pages 1-3) 2) pg. 642-648 / 6, 8, 9. (for 8 & 9 show all steps: A/C and table like we did in class for Example 1-B)
© Copyright 2026 Paperzz