Virtual Laboratories > Hypothesis Testing > 1 [2] 3 4 5 6 7
Suppose that X1, X2, ..., Xn is a random sample from the normal distribution with mean µ and variance d2. In this section we will construct hypothesis tests for µ, one of the most important special cases. This section parallels the section on Estimation of the Mean in the Normal Model in the chapter on Interval Estimation.
The test procedure is different, depending on whether d is known or unknown; for this reason d is a nuisance parameter for the problem of testing µ. The key elements in the construction of the tests are the sample mean and sample variance
and the special properties of these statistics when the sampling distribution is normal.
Suppose first that the standard deviation d is known; this assumption is usually artificial, but not always (see Exercise 23). Thus, the parameter space is {µ: µ is R} and all hypotheses define subsets of this space. The basic test statistic that we will use is
Z0 = (M - µ0) / (d / n1/2).
Note that Z0 gives the directed distance from the sample mean to µ0 in units of standard deviations. Thus, Z0 should give good information about competing hypotheses with µ0 on the boundary.
1. Show that Z0
has the normal distribution with
In particular, if µ = µ0, Z0 is the ordinary standard score and has the standard normal distribution. As usual, for p in (0, 1), we will let zp denote the quantile of order p for the standard normal distribution. For selected values of p, values zp can be obtained from the quantile applet.
2. Show that the
following tests have significance level r:
The following exercise is a special case of the general equivalence between hypothesis testing and interval estimation that was discussed in the introduction.
3. For each of the
tests in Exercise 2, show that we fail to reject H0 at significance
level a if and only if µ0 is in the corresponding 1 - r
confidence interval.
The p-value of these test can be computed in terms of the standard normal distribution function G.
4. Show that the p-values
of the tests in Exercise 2 are respectively
5. In the
mean test experiment, make sure that sigma and z quantiles
are selected. Select the normal distribution with standard deviation 2, significance level
0.1, sample size n = 20, and µ0 = 0. For each of the three
tests, do the following:
6. In the
mean
estimate experiment, make sure that sigma and z quantiles are selected.
Select the normal distribution with µ = 0 and standard deviation 2, confidence level
0.90, and sample size n = 10. For each of the three types of confidence
intervals, run the experiment 20 times, updating after each run. State the corresponding
hypotheses and significance level, and for each run, give the set of µ0 for
which the null hypothesis would be rejected.
Recall that the power function for a test of µ is Q(µ) = P(Reject H0 | µ). For the tests in Exercise 2, we can compute the power functions explicitly in terms of the standard normal distribution function G.
7. For the test H0:
µ = µ0 versus H1: µ
µ0 at significance level
r, show the following
results and sketch the graph of Q:
8. For the test H0:
µ
µ0 versus H1: µ
> µ0 at significance level a, show the following results and
sketch the graph of Q.
9. For the test of
H0: µ
µ0 versus H1:
µ < µ0 at significance level r, show the following results and
sketch the graph of Q:
10. Show that for
any of the three tests, increasing the sample size n or decreasing the standard
deviation d results in a uniformly more powerful test.
For the hypotheses H0: µ = µ0 versus H1:
µ µ0, the symmetric two-sided test in
Exercise 2 is the one most commonly used, but is not the only one. In the following
exercises, we will explore the power of a non-symmetric tests. For p in (0, 1)
consider the test
Reject H0 if and only if Z0 > z1 - pr or Z0 < z(1 - p) r.
Note that when p = 1/2, the test agrees with the symmetric test in Exercise 2.
11. Show that the
test has significance level a for any p in (0, 1).
12. Show that the
power function Q of the test satisfies the following properties, and then sketch
the graph:
13. Show that as p
increases, the test becomes more powerful for µ > µ0 and less powerful for
µ < µ0.
In many cases, the first step is to design the experiment so that the significance level is r and so that the test has a given power for a given alternative.
14. For a
one-sided test, show that the sample size n needed for a test with significance
level r and power 1 - s for the alternative µ1 is
n = (z1 - r/2 + z1 - s)2 d2 / (µ1 - µ0)2.
Hint: Set the power function equal to 1 - s and solve for n.
15. For the
two-sided test, show that the sample size n needed for a test with significance
level r and power 1 - s for the alternative µ1 is
approximately
n = (z1 - r + z1 - s)2 d2 / (µ1 - µ0)2.
Hint: In the power function for the two sided test given in Exercise , neglect the first term if µ1 < µ0 and neglect the second term if µ1 > µ0.
Consider now the more realistic assumption that d, as well as µ, is unknown. In this case, the parameter space is {(µ, d): µ in R, d > 0} and all hypotheses define subsets of this space. The basic test statistic that we will use for tests about µ is
T0 = (M - µ0) / (S / n1/2).
Recall that when µ = µ0, T0 has the student t distribution with n - 1
degrees of freedom; when µ µ0, the
distribution of T0 is known as a non-central t
distribution. As usual, tk, p will denote the quantile of order p
for the t distribution with k degrees of freedom.
16. Show that the
following tests have significance level r.
Review again the section on Estimates of the Mean, in the Chapter on Interval Estimation. The following exercise is a special case of the general equivalence between hypothesis testing and interval estimation that was discussed in the introduction.
17. For each of
the tests in Exercise 2, show that we fail to reject H0 at
significance level a if and only if µ0 is in the corresponding 1 -
r confidence interval.
The p-value of these test can be computed in terms of the distribution function Gn - 1 of the t-distribution with n - 1 degrees of freedom..
18. Show
that the p-values of the tests in Exercise 16 are respectively
19. In the
mean test experiment, make sure that S and t quantiles
are selected. Select the normal distribution with standard deviation 2, significance level
0.1, sample size n = 20, and µ0 = 0. For each of the three
tests do the following:
20. In the
mean estimate experiment, make sure that
S and t quantiles are selected.
Select the normal distribution with µ = 0 and standard deviation 2,confidence level 0.90,
and sample size n = 10. For each of the three types of intervals, run the
experiment 20 times, updating after each run. State the corresponding hypotheses and
significance level, and for each run, give the set of µ0 for which the null
hypothesis would be rejected.
The power function for the tests in Exercise 16 can be computed explicitly in terms of the non-central t distribution function. Qualitatively, the graphs of the power functions are similar to the case when µ is known, given in Exercises 7, 8, and 9.
If an upper bound d0 on the standard deviation d is known, then conservative estimates on the sample size needed for a given confidence level and a given margin of error can be obtained using the methods of Exercises 14 and 15.
One of the key assumptions that we made was that the underlying distribution is normal. Of course, in real statistical problems, we are unlikely to know much about the underlying distribution, let alone whether or not it is normal. Suppose in fact that the underlying distribution is not normal. When n is relatively large, the distribution of the sample mean will still be approximately normal by the central limit theorem, and thus our derivation should still be approximately valid. The following exercises allow you to explore the robustness of the procedure.
21. In the
mean test experiment, select the gamma distribution
with shape parameter 1 and scale parameter 1. For the three different tests and for
various significance levels, sample sizes, and values of µ0, run the
experiment 1000 times with an update frequency of 10. For each configuration, note the
relative frequency of rejecting H0. When H0 is
true, compare the relative frequency with the significance level.
22. In the
mean test experiment, select the uniform distribution on (0, 4). For the three different
tests and for various significance levels, sample sizes, and values of µ0, run
the experiment 1000 times with an update frequency of 10. For each configuration, note the
relative frequency of rejecting H0. When H0 is
true, compare the relative frequency with the significance level.
How large n needs to be for the testing procedure to work well depends, of course, on the underlying distribution; the more this distribution deviates from normality, the larger n must be. Fortunately, convergence to normality in the central limit theorem is rapid and hence, as you observed in the exercises, we can get away with relatively small sample sizes (30 or more) in most cases.
23. The length of
a certain machined part is supposed to be 10 centimeters. In fact, due to imperfections in
the manufacturing process, the actual length is a random variable. The standard deviation
is due to inherent factors in the process, which remain fairly stable over time. From
historical data, the standard deviation is known with a high degree of accuracy to
be 0.3. The mean, on the other hand, may be set by adjusting various parameters in the
process and hence may change to an unknown value fairly frequently. We are interested in
testing H0: µ = 10 versus H1: µ
10.
24. A bag of
potato chips of a certain brand has an advertised weight of 250 grams. Actually, the
weight (in grams) is a random variable. Suppose that a sample of 75 bags has mean 248 and
standard deviation 5. At the 0.05 significance level, test H0: µ
250 versus H1: µ < 250.
25. At a
tele-marketing firm, the length of a telephone solicitation (in seconds) is a random
variable. A sample of 50 calls has mean 310 and standard deviation 25. At the 0.1 level of
significance, can we conclude that µ > 300?
26. At a certain
farm the weight of a peach (in ounces) at harvest time is a random variable. A sample of
100 peaches has mean 8.2 and standard deviation 0.5. At the 0.05 level of significance,
can we conclude that µ > 8?
27. The hourly
wage for a certain type of construction work is a random variable with standard deviation
1.25. For sample of 25 workers, the mean wage was $6.75. At the 0.01 level of
significance, can we conclude that µ < 7.00?
28.
Using Michelson's
data, test to see if the velocity of
light is greater than 730 (+299000) km/sec, at the 0.1 significance level.
29.
Using Cavendish's
data, test to see if the density of the
earth is less than 5.5 times the density of water, at the 0.05 significance level.
30.
Using Short's
data, test to see if the parallax of the sun
differs from 9 seconds of a degree, at the 0.1 significance level.
31.
Using Fisher's iris
data, perform the following tests, at
the 0.1 level: