M&M’s and Skittles experiment | Hypothesis Testing  

Introduction:

In this project  we have purchased two bag of M&M’s and Skittles and performed an experiment. We  did sampling  with replacement, so this is like having two infinite populations. And we sampled 50 times for both one proportion and two proportion hypothesis testing. For hypothesis testing we define null hypothesis vs alternate hypothesis and either accept or reject null hypothesis on given sampled data.

Testing Two Proportions: 

Number of red and orange M&M’s in sample(X1) = 25 

Number of red and orange Skittles in sample(X1) = 21 

Number of M&M’s Sample (n1) = 50 

Number of Skittles Sample (n2) = 50 

Actual number of M&M’s population in packet =670 

Actual number of Skittles population in packet =409 

Actual number of Red and Orange M&M’s in packet =295 

Actual number of Red and Orange Skittles in packet =163 

Actual proportion of Red and Orange M&M’s = 295/670 = 0.44 

Actual proportion of Red and Orange skittles = 163/409 = 0.3985 

Actual difference in proportion of M&M’s and Skittles =0.44-0.3985 = 0.0415 

 

Result from Minitab: 

Test and CI for Two Proportions 

Method 

p₁: proportion where Sample 1 = Event 
p₂: proportion where Sample 2 = Event 
Difference: p₁ – p₂ 

Descriptive Statistics 

Sample  N  Event  Sample p 
Sample 1  50  25  0.500000 
Sample 2  50  21  0.420000 

Estimation for Difference 

Difference  95% CI for
Difference 
0.08  (-0.114738, 0.274738) 

CI based on normal approximation 

Test 

Null hypothesis  H₀: p₁ – p₂ = 0 
Alternative hypothesis  H₁: p₁ – p₂ ≠ 0 
Method  Z-Value  P-Value 
Normal approximation  0.80  0.422 
Fisher’s exact      0.547 

The pooled estimate of the proportion (0.46) is used for the tests. 

 

Finding and Discussion: 

Here we have tested two proportion hypothesis testing using both hand calculation and Minitab for read and orange M&M’s and Skittles. Furthermore, we have calculated difference in two proportion using 95% confidence interval. 

Using hand calculation, we have tested difference in red and orange M&M’s proportion to red and orange skittles proportion equal to 0 as Null Hypothesis vs red and orange M&M’s proportion to red and orange skittles proportion not equal to 0 using alpha=0.05. Our Calculation results don’t reject Null Hypothesis. After that we have calculated 95% confidence interval for difference in red and orange proportion which is (-0.1147, 0.2747). This result shows that we are 95% confidence that difference in proportion of red and orange M&M’s to proportion of red and orange skittles lies between interval -0.1147 and 0.2747. This also support our hypothesis testing claim that difference in proportion is equal to 0(i.e. proportion are same) because 0 lies between the confidence interval we obtained. 

Using Minitab we got a same result as that of hand calculation. We get a confidence interval of (-0.114738, 0.274738) which is same as that of hand calculation. And also we get z value equal to 0.8 which is also same as that of hand calculation. We got a p-value 0.422 which is greater than that of alpha (0.05), which means not to reject a Null hypothesis (p1=p1) and confidence interval value also support the hypothesis claim. 

In this experiment we counted an actual number of red and orange M&M’s and Skittles along with total numbers. We calculated an actual proportion value of 0.44 and 0.3985 for M&M’s and skittles respectively which is little difference from that of sample test proportions value (0.5 and 0.42 respectively).So, we got an actual proportion difference of 0.0415 which is nearly equal to zero as our hypothesis testing result.   

Testing One Proportions: 

Number of yellow Skittles in sample(X1) = 12 

Number of Skittles Sample (n1) = 40 

 Actual number of Skittles population in packet =409 

Actual number of yellow Skittles in packet =89 

Actual proportion of yellow skittles = 89/409=0.2176 

 Result from Minitab: 

Test and CI for One Proportion 

Method 

p: event proportion 
Normal approximation method is used for this analysis. 

Descriptive Statistics 

N  Event  Sample p  95% CI for p 
40  12  0.300000  (0.157987, 0.442013) 

Test 

Null hypothesis  H₀: p = 0.2 
Alternative hypothesis  H₁: p ≠ 0.2 
Z-Value  P-Value 
1.58  0.114 

 Finding and Discussion: 

Here we have tested one proportion hypothesis testing using hand calculation and Minitab for yellow skittles. Furthermore, we have calculated yellow skittle proportion using 95% confidence interval. 

Using hand calculation, we tested yellow skittles proportion equal to 0.2 as Null Hypothesis and skittles yellow proportion not equal to 0.2 using alpha=0.05. Our Calculation results don’t reject Null Hypothesis. After that we have calculated 95% confidence interval which is (0.158, 0.458). This result shows that we are 95% confidence that proportion of yellow skittles lies between interval 0.158 and 0.458. This also support our hypothesis testing claim that proportion is equal to 0.2. 

From Minitab, we get a confidence interval of (0.157987, 0.442013) which is same as that of hand calculation. Furthermore, we get a z value of 1.58 and p value of 0.1114 which is same as that of hand calculation. Since p-value is greater than that of alpha value so, we accepts the Null hypothesis that proportion is equal to 0.2. And result we got from Minitab is same as that of hand calculation. 

Moreover, when we look into the actual proportion of the population we get 0.2176 which is not exactly equal to 0.2. But, we can say that this value is nearly equal to 0. So we are good from our hypothesis testing results. 

 

This project is real life demonstration of one proportion and two proportion hypothesis testing. Similarly we can perform other hypothesis testing using Minitab software.

About sgc908

Graduate Research Assistant at North Dakota State University, Precision Agriculture, Machine Learning, Deep Learning and Big Data.

View all posts by sgc908 →