Accurately apply the formulas for calculating the chi-square statistic
Identify when validity conditions are satisfied for a chi-square goodness of fit test.
Find theory-based p-values for chi-square goodness of fit.
Draw appropriate conclusions from chi-square goodness of fit test.
As usual, we start by loading our two packages: mosaic
and ggformula
. To load a package, you use the
library()
function. I’ve put the code to load one package
into the chunk below. Add the other package you need.
library(mosaic)
# put in the other package that you need here
In this lab we will perform two different chi-square goodness of fit tests to determine whether the colors of M&Ms are uniformly distributed or whether the colors match a specified set of proportions described by the manufacturer. We will each open a mini-bag of M&Ms, count the number of Red, Orange, Yellow, Green, Blue and Brown M&Ms, then combine our data into one larger sample. Our first step is to put your counts and the combined class counts into the in-class Handout. Feel free to eat the M&Ms after the color counts are recorded.
First we will investigate whether the colors are distributed uniformly, meaning we would expect to see and equal number of each color.
\[H_0: \pi_{red} = \pi_{orange} = \pi_{yellow} = \pi_{green} = \pi_{blue}= \pi_{brown} = 1/6\]
\[H_a:\textrm{ At least one of the population proportions is different from 1/6}\]
Are the validity conditions for a chi-square test met? Explain why or why not, and what you are checking.
Use the chisq.test
function to calculate a
theory-based p-value for the hypothesis test above. Write your
executable code in the chunk below.
#chi-square goodness of fit
theory-based p-value:
chi-square:
Conclusion with context:
It is claimed that the color distributions of regular M&Ms is actually 13% red, 20% orange, 14% yellow, 16% green, 24% blue, and 13% brown. We will perform the following hypothesis test
\[H_0: \pi_{red} =0.13, \ \pi_{orange} = 0.20, \ \pi_{yellow} = 0.14, \ \pi_{green} = 0.16, \ \pi_{blue}= 0.24, \textrm{ and } \pi_{brown} = 0.13\]
\[H_a:\textrm{ At least one of the population proportions is different from the values claimed}\]
Use the worksheet from class to calculate \(\chi^2\) and show all your steps. Attach that worksheet to your lab when you turn it in.
Use the chisq.test
function to calculate a
theory-based p-value for the hypothesis test above. Write your
executable code in the code chunk below.
#chi-square goodness of fit
theory-based p-value:
chi-square:
Conclusion with context: