# Computing the p-value of one sided hypothesis test

I'm studying this subject on my own and would just like a sanity test to see if I'm doing things correctly.

Part a): we consider the test statistic $$\frac{\overline{X} - \mu}{S/\sqrt{n}}$$ which at $$\alpha = 0.05$$ significance level means we reject $$H_0$$ if $$\frac{\overline{X} - \mu}{S/\sqrt{n}} \geq z_\alpha$$.

Plugging in our observed values and $$z$$-score we see that our test statistic is $$3$$ which is greater than $$z_{0.05} = 1.645$$. Thus we reject the null hypothesis.

Part b): $$p$$-value is the probability of our test statistic being more extreme than the observed value provided $$H_0$$ is true. We have our observed value of $$3$$, and since our test statistic is approximately standard normal under $$H_0$$ this amounts to computing the probability $$P(Z \geq 3)$$ where $$Z \sim N(0,1)$$.

Using a table again I obtain a $$p$$-value of $$0.0013$$.

The back of my textbook says the $$p$$-value is approximately $$0.005$$.

Did I make a mistake somewhere?

The appropriate test to use is a one-sided Student's $$t$$-test, not a $$z$$-test. This is because the sample size is small and the standard deviation is being estimated from the data. Hence $$T \mid H_0 = \frac{\bar x - \mu_0}{s/\sqrt{n}} = \frac{10.4 - 10.1}{0.4/\sqrt{16}} = 3.$$ This statistic is $$t$$-distributed with $$n - 1 = 15$$ degrees of freedom; hence the $$p$$-value of this test is $$p = \Pr[t_{15} > 3] \approx 0.00448637.$$ Your calculated $$p$$-value is too small because it is calculated using a test statistic that inappropriately assumes that the sample standard deviation $$s = 0.4$$ is the population standard deviation $$\sigma = 0.4$$.
• I completely forgot this was an option, thank you. And I am only allowed to use the $t$-test because $X$ is normally distributed right? Feb 2 at 21:43
• @Bastiza When the data are normally distributed with unknown mean and variance, the test statistic $(\bar X - \mu_0)/(s / \sqrt{n})$ is exactly Student's $t$-distributed with $n - 1$ degrees of freedom. The key characteristic is that $s$ is the sample standard deviation, rather than the population standard deviation. If the data deviate from normality, the test may still be valid (we call such statistics robust) but the validity depends on the extent of deviation from normality. You can only use the $z$-test when you know the population standard deviation. Feb 2 at 21:47