6.2 Tests on a normal population

We assume in this section that the population rv \(X\) has distribution \(\mathcal{N}(\mu,\sigma^2),\) where both \(\mu\) and \(\sigma^2\) are unknown. We will test hypotheses about one of the two parameters from a srs \((X_1,\ldots,X_n)\) of \(X.\) The sampling distributions obtained in Section 2.2 are key for obtaining the critical regions of the forthcoming tests.

6.2.1 Tests about the mean

One-sided right test

We want to test the hypothesis77

\[\begin{align*} H_0:\mu=\mu_0 \quad \text{vs.}\quad H_1:\mu > \mu_0. \end{align*}\]

As seen in the previous section, we must fix first the bound \(\alpha\) for the probability of Type I error, that is,

\[\begin{align} \mathbb{P}(\text{Reject $H_0$}|\text{$H_0$ true})\leq \alpha.\tag{6.1} \end{align}\]

To obtain the critical region, we need a statistic \(T(X_1,\ldots,X_n).\) If we take \(\bar{X},\) whose distribution is \(\mathcal{N}(\mu_0,\sigma^2/n),\) then we should reject the null hypothesis for large values of \(\bar{X}.\) Therefore, the critical region has the form

\[\begin{align*} C=\{(x_1,\ldots,x_n)'\in \mathbb{R}^n: \bar{X}>k\}, \end{align*}\]

for a given value \(k.\) We can compute the constant \(k\) in such a way that verifies (6.1), that is, such that

\[\begin{align} \mathbb{P}(\bar{X}>k|\mu=\mu_0)\leq \alpha.\tag{6.2} \end{align}\]

But there are infinitely many values \(k\) that satisfy the above relation. For example, if we consider a value \(k_1\) that is not the smallest one, then there will be another value \(k_2<k_1\) such that

\[\begin{align*} \mathbb{P}(\bar{X}>k_1|\mu=\mu_0)\leq \mathbb{P}(\bar{X}>k_2|\mu=\mu_0)\leq \alpha. \end{align*}\]

Then, it will happen that the probability of Type II error of the test with critical region \(\{\bar{X}>k_1\}\) will be larger than the one for the test with critical region \(\{\bar{X}>k_2\}.\) Therefore, among the tests with critical region of the type \(\{\bar{X}>k\}\) that verify (6.2), the most efficient is the one with smallest \(k.\)

However, recall that in this case it is not possible to determine the smallest \(k\) that verifies (6.2) since the distribution of \(\bar{X}\) is partially unknown (\(\sigma^2\) is unknown). But if we estimate \(\sigma^2\) with \(S'^2,\) then a test statistic is

\[\begin{align} T(X_1,\ldots,X_n)=\frac{\bar{X}-\mu_0}{S'/\sqrt{n}}\stackrel{H_0}{\sim} t_{n-1}.\tag{6.3} \end{align}\]

Determining the critical region from \(T\) is simple, since the range of \(T\) is \(\mathbb{R}\) and therefore the critical region is an interval of \(\mathbb{R}.\) The null hypothesis is to be rejected for large values of \(T,\) hence the critical region is of the form \(\{T(x_1,\ldots,x_n)>k\}.\) We must select the smallest \(k\) such that

\[\begin{align*} \mathbb{P}(T>k|\mu=\mu_0)\leq \alpha. \end{align*}\]

From here, it is deduced that \(k=t_{n-1;\alpha}.\) Therefore, the critical region is

\[\begin{align*} C &=\{(x_1,\ldots,x_n)'\in\mathbb{R}^n: T(x_1,\ldots,x_n)>t_{n-1;\alpha}\} \\ &=\left\{(x_1,\ldots,x_n)'\in\mathbb{R}^n: \frac{\bar{X}-\mu_0}{S'/\sqrt{n}}>t_{n-1;\alpha} \right\} \\ &=\left\{(x_1,\ldots,x_n)'\in\mathbb{R}^n: \bar{X}>\mu_0+t_{n-1;\alpha}\frac{S'}{\sqrt{n}}\right\}. \end{align*}\]

Observe that the quantity \(t_{n-1;\alpha}\frac{S'}{\sqrt{n}}\) can be regarded as the “uncertainty tolerance” that is added to the no-uncertainty rule that would reject \(H_0:\mu=\mu_0\) if \(\bar{X}>\mu_0.\)

One-sided left test

If the null hypothesis to test is

\[\begin{align*} H_0:\mu=\mu_0 \quad \text{vs.}\quad H_1:\mu < \mu_0, \end{align*}\]

then the test statistic is exactly the same as before, but in this case we must reject the null hypothesis for small values of \(T.\) Therefore, the critical region has the form \(\{T<k\}.\) Fixing a significance level \(\alpha\) and selecting the larger \(k\) that verifies the relation

\[\begin{align*} \mathbb{P}(T<k|\mu=\mu_0)\leq \alpha \end{align*}\]

we get that the value of \(k\) is \(k=-t_{n-1;\alpha}\) and the critical region is

\[\begin{align*} C=\{(x_1,\ldots,x_n)'\in\mathbb{R}^n : T(x_1,\ldots,x_n)<-t_{n-1;\alpha}\}. \end{align*}\]

Two-sided test

Now we want to test the hypothesis

\[\begin{align*} H_0:\mu=\mu_0 \quad \text{vs.}\quad H_1:\mu\neq \mu_0. \end{align*}\]

For the same test statistic (6.3), now we will reject for large absolute values of \(T\) that will indicate deviation from \(H_0.\) That is, the critical region has the form

\[\begin{align*} \{(x_1,\ldots,x_n)'\in\mathbb{R}^n: T(x_1,\ldots,x_n)\in(-\infty,k_1)\cup (k_2,\infty)\}. \end{align*}\]

Now we must determine the value of the two constants \(k_1\) and \(k_2\) in such a way that

\[\begin{align*} \mathbb{P}(T\in(-\infty,k_1)\cup (k_2,\infty)|\mu=\mu_0)\leq \alpha. \end{align*}\]

Evenly splitting \(\alpha/2\) to both tails, since the distribution of \(T\) under \(H_0\) is \(t_{n-1}\) and is symmetric, gives \(k_2=t_{n-1;\alpha/2}\) and \(k_1=-t_{n-1;\alpha/2}.\) Then, the critical region is

\[\begin{align*} C=\{(x_1,\ldots,x_n)'\in\mathbb{R}^n : |T(x_1,\ldots,x_n)|>t_{n-1;\alpha/2}\}. \end{align*}\]

Example 6.5 Eight bullets made of a new type of gunpowder were fired in a gun, and their initial speeds in m/s were measured:

\[\begin{align*} 910,\quad 921,\quad 918,\quad 896,\quad 909,\quad 905,\quad 895,\quad 903. \end{align*}\]

The producer of the gunpowder claims that the new gunpowder delivers an average initial speed above \(915\) m/s. Is the sample providing evidence against such claim, at the significance level \(\alpha=0.025\)? Assume that the initial speeds follow a normal distribution.

We want to test the hypothesis

\[\begin{align*} H_0:\mu=915\quad \text{vs.}\quad H_1:\mu<915. \end{align*}\]

The critical region is

\[\begin{align*} C=\{T<-t_{7;0.025}\approx-2.365\}. \end{align*}\]

The observed value of the statistic is

\[\begin{align*} T=\frac{\bar{X}-\mu_0}{S'/\sqrt{n}}\approx\frac{907.125-915}{9.3723/\sqrt{8}}\approx -2.377<-2.365. \end{align*}\]

Then, the observed initial speeds are sufficiently low to question the claim of the gunpowder producer.

Recall that \(t_{7;0.025}\) can be computed as

qt(0.025, df = 7, lower.tail = FALSE)
## [1] 2.364624

The R function t.test() implements the (one-sample) test of \(H_0:\mu=\mu_0\) against different alternatives. The main arguments of the function are as follows:

t.test(x, alternative = c("two.sided", "less", "greater"), mu = 0, ...)

The argument mu stands for \(\mu_0.\) The table below shows the encoding of the alternative argument:

alternative "two.sided" "less" "greater"
\(H_1\) \(\mu\neq\mu_0\) \(\mu<\mu_0\) \(\mu>\mu_0\)

Example 6.6 The t.test() solution to Example 6.5 is very simple:

# Apply t.test() with H1: mu < 915
t.test(x = c(910, 921, 918, 896, 909, 905, 895, 903), mu = 915,
       alternative = "less")
## 
##  One Sample t-test
## 
## data:  c(910, 921, 918, 896, 909, 905, 895, 903)
## t = -2.3766, df = 7, p-value = 0.02456
## alternative hypothesis: true mean is less than 915
## 95 percent confidence interval:
##      -Inf 913.4029
## sample estimates:
## mean of x 
##   907.125

That the reported \(p\)-value is smaller than \(\alpha=0.025\) indicates rejection of \(H_0,\) as seen in Section 6.5.

6.2.2 Tests about the variance

We study in this section the tests for the following hypotheses:

  1. \(H_0:\sigma^2=\sigma_0^2\) vs. \(H_1:\sigma^2>\sigma_0^2;\)
  2. \(H_0:\sigma^2=\sigma_0^2\) vs. \(H_1:\sigma^2<\sigma_0^2;\)
  3. \(H_0:\sigma^2=\sigma_0^2\) vs. \(H_1:\sigma^2\neq\sigma_0^2.\)

An estimator of \(\sigma^2\) is the sample quasivariance, \(S'^2,\) for whom we perfectly know its distribution under the null hypothesis,

\[\begin{align*} U=\frac{(n-1)S'^2}{\sigma_0^2}\stackrel{H_0}\sim \chi_{n-1}^2. \end{align*}\]

Therefore, \(U\) is a test statistic for the testing problems a, b, and c.

When testing case a, if the null hypothesis is not true, \(U\) will tend to have large values. Therefore, the critical region is of the form \(\{U>k\}.\) For obtaining the best value \(k,\) we select the significance level \(\alpha\) and take the smallest \(k\) such that

\[\begin{align*} \mathbb{P}(U>k|\sigma^2=\sigma_0^2)\leq \alpha. \end{align*}\]

Then, the best choice is \(k=\chi_{n-1;\alpha}^2,\) so the critical region is

\[\begin{align*} C_a=\{(x_1,\ldots,x_n)'\in\mathbb{R}^n:U(x_1,\ldots,x_n)>\chi_{n-1;\alpha}^2\}. \end{align*}\]

With an analogous reasoning, the critical region for b follows:

\[\begin{align*} C_b=\{(x_1,\ldots,x_n)'\in\mathbb{R}^n:U(x_1,\ldots,x_n)<\chi_{n-1;1-\alpha}^2\}. \end{align*}\]

The critical region for c arises from splitting evenly the probability \(\alpha\) in the critical regions of a and b:

\[\begin{align*} C_c=\{(x_1,\ldots,x_n)'\in\mathbb{R}^n:U(x_1,\ldots,x_n)>\chi_{n-1;\alpha/2}^2 \ \text{or}\ U(x_1,\ldots,x_n)<\chi_{n-1;1-\alpha/2}^2\}. \end{align*}\]

Example 6.7 A company claims that the diameter of one of the parts of an engine it produces has a production variance not larger than \(0.1290\) squared millimeters. A srs of \(10\) pieces revealed \(S'^2=0.1935.\) Assuming that the measurements of the diameter follow a normal distribution, test at a significance level \(\alpha=0.05\)

\[\begin{align*} H_0:\sigma^2=0.1290\quad \text{vs.} \quad H_1:\sigma^2>0.1290. \end{align*}\]

The test statistic is

\[\begin{align*} U=\frac{(n-1)S'^2}{\sigma_0^2}=\frac{9\times 0.1935}{0.1290}=13.5 \end{align*}\]

and the rejection region is

\[\begin{align*} C=\{U>\chi_{9;0.05}^2\approx16.919\}. \end{align*}\]

Since \(U=13.5<16.919,\) then the data does not provide any evidence against the variance of the diameter being larger than \(0.1290\) squared milliliters. Therefore, there is no evidence against the company’s claim.

Unfortunately, there is no function in base R to conduct the (one-sample) variance test.


  1. In some textbooks it is sometimes written \(H_0:\mu\leq\mu_0\) vs. \(H_1:\mu > \mu_0.\) However, this notation introduces inconsistencies when determining the distribution of the test statistic under \(H_0,\) as then several values for \(\mu\) are possible. For that reason it is avoided.↩︎