6.2 Tests on a normal population
We assume in this section that the population rv X has distribution N(μ,σ2), where both μ and σ2 are unknown. We will test hypotheses about one of the two parameters from a srs (X1,…,Xn) 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
H0:μ=μ0vs.H1:μ>μ0.
As seen in the previous section, we must fix first the bound α for the probability of Type I error, that is,
P(Reject H0|H0 true)≤α.
To obtain the critical region, we need a statistic T(X1,…,Xn). If we take ˉX, whose distribution is N(μ0,σ2/n), then we should reject the null hypothesis for large values of ˉX. Therefore, the critical region has the form
C={(x1,…,xn)′∈Rn:ˉX>k},
for a given value k. We can compute the constant k in such a way that verifies (6.1), that is, such that
P(ˉX>k|μ=μ0)≤α.
But there are infinitely many values k that satisfy the above relation. For example, if we consider a value k1 that is not the smallest one, then there will be another value k2<k1 such that
P(ˉX>k1|μ=μ0)≤P(ˉX>k2|μ=μ0)≤α.
Then, it will happen that the probability of Type II error of the test with critical region {ˉX>k1} will be larger than the one for the test with critical region {ˉX>k2}. Therefore, among the tests with critical region of the type {ˉ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 ˉX is partially unknown (σ2 is unknown). But if we estimate σ2 with S′2, then a test statistic is
T(X1,…,Xn)=ˉX−μ0S′/√nH0∼tn−1.
Determining the critical region from T is simple, since the range of T is R and therefore the critical region is an interval of R. The null hypothesis is to be rejected for large values of T, hence the critical region is of the form {T(x1,…,xn)>k}. We must select the smallest k such that
P(T>k|μ=μ0)≤α.
From here, it is deduced that k=tn−1;α. Therefore, the critical region is
C={(x1,…,xn)′∈Rn:T(x1,…,xn)>tn−1;α}={(x1,…,xn)′∈Rn:ˉX−μ0S′/√n>tn−1;α}={(x1,…,xn)′∈Rn:ˉX>μ0+tn−1;αS′√n}.
Observe that the quantity tn−1;αS′√n can be regarded as the “uncertainty tolerance” that is added to the no-uncertainty rule that would reject H0:μ=μ0 if ˉX>μ0.
One-sided left test
If the null hypothesis to test is
H0:μ=μ0vs.H1:μ<μ0,
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 α and selecting the larger k that verifies the relation
P(T<k|μ=μ0)≤α
we get that the value of k is k=−tn−1;α and the critical region is
C={(x1,…,xn)′∈Rn:T(x1,…,xn)<−tn−1;α}.
Two-sided test
Now we want to test the hypothesis
H0:μ=μ0vs.H1:μ≠μ0.
For the same test statistic (6.3), now we will reject for large absolute values of T that will indicate deviation from H0. That is, the critical region has the form
{(x1,…,xn)′∈Rn:T(x1,…,xn)∈(−∞,k1)∪(k2,∞)}.
Now we must determine the value of the two constants k1 and k2 in such a way that
P(T∈(−∞,k1)∪(k2,∞)|μ=μ0)≤α.
Evenly splitting α/2 to both tails, since the distribution of T under H0 is tn−1 and is symmetric, gives k2=tn−1;α/2 and k1=−tn−1;α/2. Then, the critical region is
C={(x1,…,xn)′∈Rn:|T(x1,…,xn)|>tn−1;α/2}.
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:
910,921,918,896,909,905,895,903.
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 α=0.025? Assume that the initial speeds follow a normal distribution.
We want to test the hypothesis
H0:μ=915vs.H1:μ<915.
The critical region is
C={T<−t7;0.025≈−2.365}.
The observed value of the statistic is
T=ˉX−μ0S′/√n≈907.125−9159.3723/√8≈−2.377<−2.365.
Then, the observed initial speeds are sufficiently low to question the claim of the gunpowder producer.
Recall that t7;0.025 can be computed as
The R function t.test()
implements the (one-sample) test of H0:μ=μ0 against different alternatives. The main arguments of the function are as follows:
The argument mu
stands for μ0. The table below shows the encoding of the alternative
argument:
alternative |
"two.sided" |
"less" |
"greater" |
---|---|---|---|
H1 | μ≠μ0 | μ<μ0 | μ>μ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 α=0.025 indicates rejection of H0, as seen in Section 6.5.
6.2.2 Tests about the variance
We study in this section the tests for the following hypotheses:
- H0:σ2=σ20 vs. H1:σ2>σ20;
- H0:σ2=σ20 vs. H1:σ2<σ20;
- H0:σ2=σ20 vs. H1:σ2≠σ20.
An estimator of σ2 is the sample quasivariance, S′2, for whom we perfectly know its distribution under the null hypothesis,
U=(n−1)S′2σ20H0∼χ2n−1.
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 α and take the smallest k such that
P(U>k|σ2=σ20)≤α.
Then, the best choice is k=χ2n−1;α, so the critical region is
Ca={(x1,…,xn)′∈Rn:U(x1,…,xn)>χ2n−1;α}.
With an analogous reasoning, the critical region for b follows:
Cb={(x1,…,xn)′∈Rn:U(x1,…,xn)<χ2n−1;1−α}.
The critical region for c arises from splitting evenly the probability α in the critical regions of a and b:
Cc={(x1,…,xn)′∈Rn:U(x1,…,xn)>χ2n−1;α/2 or U(x1,…,xn)<χ2n−1;1−α/2}.
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 α=0.05
H0:σ2=0.1290vs.H1:σ2>0.1290.
The test statistic is
U=(n−1)S′2σ20=9×0.19350.1290=13.5
and the rejection region is
C={U>χ29;0.05≈16.919}.
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.
In some textbooks it is sometimes written H0:μ≤μ0 vs. H1:μ>μ0. However, this notation introduces inconsistencies when determining the distribution of the test statistic under H0, as then several values for μ are possible. For that reason it is avoided.↩︎