Hypothesis testing using p-values: Example 2: The Weight of Chocolate Bars

Imagine you work at a chocolate factory and are responsible for ensuring chocolate bars’ quality. The factory claims that their chocolate bars have an average weight of 100 grams. However, you suspect that some of the machines might be overfilling the bars.

Your null hypothesis (H_0) is that the chocolate bars indeed weigh 100 grams on average, and your alternative hypothesis (H_A) is that they weigh more than 100 grams.

To test this, you randomly sample 30 chocolate bars and find that they have an average weight of \bar{x} = 105 \text{ grams}
and the sample standard deviation is s = 2 \text{ grams}.

So to write everything in math terms, the null hypothesis isH_0: \mu = 100
because I want to reject the fact that on average each chocolate bar weighs 100 grams. I think each bar weighs more than 100 grams on average. Therefore, my alternative hypothesis is H_A: \mu > 100.

Now let us pick our significance level to be \alpha = 0.05. We should pick this in advance to further calculation to avoid bias in the conclusion because, as shown in the previous example, the conclusion can be different at different levels of \alpha.

The test statistic is Z = \frac{\bar{x} - 100}{s / \sqrt{n}} = \frac{105 - 100}{2 / \sqrt{30}} = \frac{5 \times \sqrt{30}}{2} \approx 13.69

In Figure 3 above, the orange dot region is the critical region (rejection region), which contains the values that should not happen if the null hypothesis is true. The critical value is the value that separates the normal region and the rejection region. Here by the normal region I mean the region where x should fall into if H_0 is true. The area of the orange dot region is the significant value \alpha (Note that the area under the curve is 1, just as the probabilities of all events should sum to 1. The right tail part (the orange dot region) represents the observations that are bigger than expected, i.e., the abnormal region). Here we choose \alpha = 0.05 which leads to the critical value z_{0.05} = 1.96. So we consider all values that are bigger than z_{0.05} = 1.96 to be abnormal. Note that Z \approx 13.69 > z_{0.05}
Therefore we reject the null hypothesis and conclude that on average each bar weighs more than 100 grams. Okay! That’s good for … the customers – the ones who don’t even know that they are lucky!


Discover more from Science Comics

Subscribe to get the latest posts sent to your email.

Leave a Reply

error: Content is protected !!