# Hypothesis testing for sample means within a normal distrubution

The context of the question is that a bakery bakes cakes and the mass of cake is demoted by $$X$$ such that $$X \sim N(300, 40^2)$$. A sample of 12 cakes is taken and the mean of the sample is 292g. The question wants me to find the $$p$$-value and test to see if the mean has changed at 10% significance.

So I know how to carry out the test as $$\overline{X_{12}} \sim N(300,\frac{40^2}{12})$$, But what would the p-value I'm trying to calculate be? I know the p-value is 0.244.

The hypothesis testing: $$H_0: \mu =300\\ H_1:\mu \ne 300 \\ z=\frac{\bar{x}-300}{40/\sqrt{12}}=-0.6928\\ p\text{-value}=P(z<-0.6928)=0.244 \ \\ \text{Reject H_0 if p<\frac{\alpha}{2}}: \ 0.244\not < 0.05 \Rightarrow \text{Fail to Reject} \ H_0.$$ Note: $$p$$-value calculation:

1) In MS Excel: $$=NORM.S.DIST(-0.6928;1)$$.

2) WolframAlpha.

3) Z table.

$$\newcommand{\P}{\mathbb{P}}$$It appears that you have $$X\sim N(\mu, 40^2)$$ (known variance), and your null hypothesis is that $$\mu = 300$$, with alternative hypothesis $$\mu\ne 300$$. For this, we will be using a two-tailed test.

Under the null hypothesis, we have $$\overline{X}_{12}\sim N\left(300, \frac{40^2}{12}\right)$$, or $$T := \frac{\overline{X}_{12} - 300}{40/\sqrt{12}}\sim N(0,1)$$. The $$p$$-value is the probability of getting a "more extreme" result for the test-statistic $$T$$ than observed under the null hypothesis (note the observed value is $$\color{blue}{\frac{292-300}{40/\sqrt{12}}}$$), which for our two-tailed test means that the $$p$$-value is

$$\P\left(|T| > \left| \frac{292-300}{40/\sqrt{12}}\right| \right) \quad \text{where }T \sim N(0,1).$$

If you compute this probability, it seems you get double the answer you wrote. So the answers probably used a one-tailed test, which would be the case if our alternative hypothesis was $$\mu < 300$$, in which case the $$p$$-value would be

$$\P\left(T < \frac{292-300}{40/\sqrt{12}} \right) \quad \text{where }T \sim N(0,1).$$

This will get you the reported answer. The reason I used a two-tailed test is because I interpreted the alternative hypothesis as being with a $$\ne$$ sign rather than $$<$$, because the wording of the question was "mean has changed".