# Hypothesis testing for difference of two means

The weight of 11 schoolchildren was measured before and after six months on the proposed lunch plan.

The weights before were: 132, 146, 135, 141, 139, 162, 128, 137, 145, 151, 131

The weights after were: 136, 145, 140, 147, 142, 160, 137, 136, 149, 158, 120

With $\alpha = 0.95$, conduct a hypothesis test, including hypotheses, test statistic, rejection region, and p-value, testing whether there is a difference between the mean weight before vs. after.

So far, I've found: $\overline{d} = -2.091, s_d = 5.576$

I've identified the hypotheses as

$H_0: \mu_x = \mu_y \ \ , H_1: \mu_x \ne \mu_y$

What would be the next step? What would be the test statistic? The population variance is unknown, right? Since I only know the data for my small sample.

The two test statistics which come to mind are:

$$Z = \frac{\bar{X}-\mu_0}{\frac{\sigma}{\sqrt{n}}}$$

$$T = \frac{\bar{X}-\mu_0}{\frac{S}{\sqrt{n}}}$$

Both of which involve $\mu_0$, which I don't know.

Any help will be really appreciated.

• hint: $H_0: \mu_1 = \mu_2, H_1:\mu_1 \neq \mu_2$, and use student $t$ distribution. – DeepSea May 1 '15 at 21:44
• Doesn't student t distribution involve knowing $\mu_0$? – Amy May 1 '15 at 21:58
• We don't have such $\mu_0$ . – DeepSea May 1 '15 at 22:01

Paired t test

Specify hypotheses and test statistic. It is useful to take $H_0: \mu_d = 0$ and the alternative as $H_1: \mu_d \ne 0.$ Then the $T$-statistic is $$T = \frac{\bar d - \mu_d}{s_d/\sqrt{n}} = \frac{\bar d}{s_d/\sqrt{n}} = \frac{-2.091}{5.576/\sqrt{11}} = -1.244.$$

Distribution of test statistic. If the null hypothesis it true, your $T$-statistic has Student's t distribution with 10 degrees of freedom. You must mean that you intend to test at the 5% level.

Rejection region. For your two-sided alternative (with an $\ne$-sign), the rejection region is found by cutting 2.5% of the area under the t density curve from each tail. Tables give these values as $\pm 2.228.$ Thus you reject the null hypothesis if $|T| \ge 2.228.$ In terms of $T,$ the rejection region has two parts $(-\infty,-2.228]$ and $[2.228, \infty).$ In your case $|T| = 1.244 < 2.228$, so you do not reject $H_0.$

P-value. Finding the exact P-value requires software. I did this paired t-test in R statistical software as shown below. (The initial steps were just to check your computations, which are correct.)

 bef = c(132, 146, 135, 141, 139, 162, 128, 137, 145, 151, 131)
aft = c(136, 145, 140, 147, 142, 160, 137, 136, 149, 158, 120)
mean(bef-aft)
## -2.090909
sd(bef-aft)
## 5.575922
t.test(bef, aft, paired=T)

##         Paired t-test
##
## data:  bef and aft
## t = -1.2437, df = 10, p-value = 0.242
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -5.836865  1.655046


From the output, you can see that the P-value is 0.242. At the 5% level, you would reject $H_0$ if the P-value were 5% or smaller, but it is not.

Confidence interval. The "95%" you mentioned earlier must apply to the confidence interval shown in the output. It says that we have "95% confidence" that the true difference in population means is in the interval $(-5.84, 1.66).$ Notice that this interval includes 0. That is, 0 is a believable value of $\mu_d$, and--from a testing point of view--this is another reason not to reject the null hypothesis.

• Absolutely perfect explanation, thanks! – Amy May 1 '15 at 22:32
• I added the computer output with the P-value while you were posting your gracious comment. – BruceET May 1 '15 at 22:42