The following are yields (in bushels/acre) for two different varieties of winter wheat (call them A and B):
A: 62.7, 71.4, 76.7, 59.3, 59.7, 64.7, 69.1, 70.5
B: 69.8, 61.5, 49.9, 53.8, 65.1, 66.7, 47.8, 51.1
Can we conclude at the 5% level that the average yields are equal?
Solution
Given that the sample size $n_1 = 8$
, $n_2 = 8$
, sample mean $\overline{x}= 66.7625$
,
$\overline{y}= 58.2125$
, sample standard deviation $s_1 = 6.165$
and $s_2 = 8.553$
.
Hypothesis testing problem
The hypothesis testing problem is
$H_0 : \mu_1 = \mu_2$
against $H_1 : \mu_1 \neq \mu_2$
($\textit{two-tailed}$)
Test statistic
The test statistic is
$$ \begin{aligned} t& =\frac{(\overline{x} -\overline{y})-(\mu_1 - \mu_2)}{sp\sqrt{\frac{1}{n_1}+\frac{1}{n_2}}} \end{aligned} $$
where
$$ \begin{aligned} s_p & = \sqrt{\frac{(n_1-1)s_1^2 +(n_2-1)s_2^2}{n_1+n_2-2}}\\ & = \sqrt{\frac{(8-1)6.1646313^2 +(8-1)8.553435^2}{8+8-2}}\\ & = 7.4553. \end{aligned} $$
Specify the level of significance
The significance level is $\alpha = 0.05$.
Determine the critical value
As the alternative hypothesis is $\textit{two-tailed}$, the critical value of $t$ using $\alpha = 0.05$
and degrees of freedom $n_1+n_2-2=8+8-2=14$
$\text{are}$ $\text{-2.145 and 2.145}$.

The rejection region (i.e. critical region) is $\text{t < -2.145 or t > 2.145}$.
Computation
The test statistic under the null hypothesis is
$$ \begin{aligned} t&=\frac{(\overline{x} -\overline{y})-(\mu_1-\mu_2)}{sp\sqrt{\big(\frac{1}{n_1}+\frac{1}{n_2}\big)}}\\ &= \frac{(66.7625-58.2125)-0}{7.4553\sqrt{\big(\frac{1}{8}+\frac{1}{8}\big)}}\\ &= 2.2937 \end{aligned} $$
Decision
Traditional approach:
The rejection region (i.e. critical region) is $\text{t < -2.145 or t > 2.145}$.
The test statistic is $t =2.2937$ which falls $\text{inside}$ the critical region, we $\textit{reject}$ the null hypothesis.
OR
$p$-value approach:
The test is $\textit{two-tailed}$ test, so p-value is the
area to the $\textit{extreme}$ of the test statistic ($t=2.2937$). That is p-value = $2*P(t\geq 2.2937 ) = 0.0378$.
The p-value is $0.0378$ which is $\textit{less than}$ the significance level of $\alpha = 0.05$, we $\textit{reject}$ the null hypothesis.
We conclude at the 5% level that the average yields are not equal.