Lecture 31 Standard Tests Revisited
After two lectures on Bayesian inference we return to the tests of lectures 22 to 25. The most commonly used statistical tests, the -test, the -test, the chi-squared test for a variance and the -test, are often taught as recipes. In this lecture we consider these tests from the perspective of the module: each of them is based on a pivot in the sense of lecture 26.
31.1 Tests from Pivots
Every test in this lecture is based on the following principle: the distribution of the test statistic under the null hypothesis is known, and the test rejects if the statistic lies beyond a quantile of this distribution, taken from a table. In the language of lecture 26, the test statistic is a pivot evaluated at the hypothesised value , and inverting the test as in lemma 26.6 gives the confidence interval based on this pivot.
We use the notation , and for the quantiles from lectures 22 and 26, so that for . Tables A.4, A.5 and A.6 in appendix A show these quantiles for a few values of . At level , a one-sided test which rejects for large values of the statistic needs the -quantile and a one-sided test which rejects for small values needs the -quantile. A two-sided test needs the -quantile and, if the distribution is not symmetric, also the -quantile. A -value in the sense of definition 22.9 cannot be found exactly from such a table, but it can be bracketed between two tabulated levels, as in example 31.2 below.
The most basic example is the -test from lecture 22. In this lecture we write instead of for the mean of the normal distribution, since the variance will be a second parameter. If are i.i.d. with known , then is standard normally distributed under . In examples 22.7 and 22.8 we rejected for or , for the one-sided and the two-sided alternative, respectively. The drawback of this test is that the variance of the data must be known. In the rest of the lecture the variance is unknown.
31.2 The One-Sample -Test
Let be i.i.d. , where both parameters are unknown, and let and be the sample mean and sample variance, respectively. If we replace in the definition of by the estimator , we get the test statistic
In example 26.4 we have seen that for the statistic is the ratio of the standard normal variable to the square root of . By proposition A.4, we have and the numerator and denominator of the ratio are independent. Consequently, by definition A.5. This leads to the following tests.
Let and let be i.i.d. , where the parameters and are unknown. Let and let be given by (31.1). Then the three tests of , which reject if
for the alternatives , and , respectively, have size , whatever the value of .
Under we have for every value of , as shown above. By the definition of the quantile we have . This is the size of the first test. The density of the distribution is symmetric about zero, and thus for the second test we have . For the third test the same symmetry gives . Since these probabilities do not depend on , the probability of rejection under is for every value of , and thus the size of each test is . This completes the proof. ∎
These are the one-sided and two-sided one-sample -tests. Since for every , the -test requires a larger standardised deviation than the -test before it can reject the hypothesis. This is the price we pay for estimating , and it decreases as increases. As in lecture 22, the one-sided tests have level for the composite null hypotheses and . We state this without proof.
By exercise 25.1, the generalised likelihood-ratio statistic for against the alternative is an increasing function of . Thus the two-sided -test is the generalised likelihood-ratio test for this problem, with the exact quantile in place of the approximation of Wilks’ theorem (theorem 25.3).
A quantity has nominal value , and ten measurements give
Assume that the measurements are i.i.d. . We want to test against at level . The sum of the observations is , so that . The sum of the squared deviations from is , so that and . The observed value of the test statistic is
The row for degrees of freedom in table A.5 shows that we have , , and . For a two-sided test with level we need and since we can reject : the deviation of the measurements from the nominal value is significant at level . The same row also brackets the -value. The observed value falls between and and thus the two-sided -value, for , is between and ; the two-sided test also rejects at level but not at level . If instead the question had been whether the measurements were high, the one-sided test for against at level would have compared to and would have rejected , with a -value between and .
31.3 The Chi-Squared Test for a Variance
The second question about a normal sample concerns the spread of the data: we want to test whether the variance equals a given value . By proposition A.4, the pivot is distributed whatever the value of the mean, and the test follows the structure of the test from the previous section.
Let and let be i.i.d. , where and are unknown. Let and let
Each of the three tests for , which reject if
for the alternatives , and , respectively, has size , whatever the value of .
Under we have by proposition A.4, for every value of . The first two rejection probabilities are and by the definition of the quantiles. For the third, the events and are disjoint and each of them has probability , and thus the rejection probability is . This completes the proof. ∎
Unlike the distribution, the chi-squared distribution is not symmetric, and thus a two-sided test needs a separate value from the table for each of the two tails. Inverting the two-sided test gives the confidence interval from example 26.5.
The output of a machine is specified to have variance . After an adjustment of the machine, a sample of i.i.d. observations has sample variance . We want to test against at level . The observed value of the test statistic is , and the test rejects if . The row for degrees of freedom in table A.6 shows that we have . We also need the value , which is not tabulated. Since we can reject . The -value is for , and since this value is between and .
The same pivot gives the power function of the test. If the true variance is , then and , and thus we find
This probability decreases as increases. Thus, over the composite null hypothesis the power function is largest at , and the test has size for this null hypothesis as well. Exercise 31.2 treats the test against in the same way.
31.4 Paired and Two-Sample Problems
The tests so far have considered a single sample. We now consider three more standard tests for two sets of measurements. Each of these tests is again based on a pivot.
The first of these three tests is the paired -test. Assume that we have observed data in pairs , , e.g. before and after measurements for the same subject. The two measurements for one subject are in general not independent, and thus the data cannot be treated as two independent samples. Instead, we reduce the data for each pair to the difference , model the differences as i.i.d. and apply proposition 31.1 with : the test statistic , constructed from the sample mean and variance of the differences, is distributed under . The model only makes assumptions about the differences (exercise 31.3).
The second test is the two-sample -test. Here we assume that are i.i.d. and that are i.i.d. , where the two samples are independent of each other and have the same unknown variance . We consider . If and are the sample variances of the two samples, the pooled estimator for the common variance is
and the test statistic is
The distribution follows as in the one-sample case. Proposition A.4, applied to each of the two samples, shows that is the sum of two independent chi-squared variables with and degrees of freedom, and that this sum is independent of . By definition A.2, the sum is distributed. The test of against rejects if , and the one-sided variants of the test use .
The third test is the -test for two variances. In the same two-sample setting, but now with variances and which are allowed to be different, the ratio is distributed by proposition A.4 and definition A.5. Under the unknown variances cancel and the statistic is distributed. The two-sided test rejects if does not fall into the interval , where is the -quantile of .
31.5 Which Test?
Table 31.1 summarises the six tests. The choice between them is determined by the following three questions: Is the parameter in question a mean or a variance? Is there one sample or two? If two samples, are the observations paired or independent? All six tests assume that the data are normally distributed.
| Question | Statistic | Null distribution | |
| one mean, known | |||
| one mean, unknown | |||
| paired differences | |||
| one variance, unknown | |||
| two means, common | |||
| two variances |
-
•
Each of the standard tests for normal data is based on a pivot from lecture 26, evaluated at the null value and compared to a quantile of the known null distribution. Inverting the test gives the corresponding confidence interval.
-
•
The one-sample -test uses under and rejects for (one-sided) or (two-sided). The two-sided test is the generalised likelihood-ratio test with an exact critical value.
-
•
The chi-squared test for a variance uses under . A two-sided test requires both lower and upper quantiles, since the distribution is not symmetric.
-
•
The paired -test is a one-sample -test for the differences. Similarly, the two-sample -test with pooled variance and the -test for two variances follow this pattern, using the and distributions.
-
•
The table lists only a few quantiles and often the -value is bracketed between two tabulated levels.
Eight independent measurements of a quantity with nominal value are given by
Assume that the measurements are i.i.d. , where both parameters are unknown. From table A.5 we find , , and .
-
1.
Determine , and the observed value of the test statistic from (31.1) for .
-
2.
For , test at levels and . Bracket the -value.
-
3.
For , test at the same two levels and bracket the -value.
-
4.
Calculate the -interval for from example 26.4 and discuss how it relates to your answer in the previous part.
A sample of i.i.d. observations has sample variance , and the process generating the sample is specified to have variance at most . From table A.6 we find , , and .
-
1.
Test against at levels and . Bracket the -value.
-
2.
Test against at level .
-
3.
Show that the power function of the one-sided test from proposition 31.3 is given by where , and that this power function is increasing in . Deduce that the test has size for the composite null hypothesis .
-
4.
Explain why the one-sided test from the first part and the two-sided test from the second part give different results at level . Which of the two tests has the larger power against alternatives ?
The following data give the reaction times of six subjects before and after a training period.
| subject | 1 | 2 | 3 | 4 | 5 | 6 |
| before () | 72 | 65 | 80 | 58 | 69 | 75 |
| after () | 68 | 66 | 74 | 55 | 63 | 70 |
We want to know whether the training reduced the mean reaction time. From table A.5 we find , , and .
-
1.
Write down the model and hypotheses for the paired -test and carry out the test at levels and .
-
2.
Determine a confidence interval for the mean reduction in reaction time.
-
3.
A colleague, not knowing that the two rows of the table give paired data, performs the two-sample -test (31.3). The sample variances of the two rows are and , respectively. What is the test statistic and what is the decision of your colleague at level ? Explain why the paired analysis is the appropriate one and why the two analyses give different results.
In example 26.4 we have observed a sample of values, where and , and we have found the -interval for . In example 26.5, for the same data, we have found the interval for . In exercise 26.4 we have seen that the hypothesis was rejected at level , using lemma 26.6 alone. Now use the values , , and .
-
1.
Perform a two-sided -test for and state the decision. Repeat the test for and check that the result is consistent with the interval.
-
2.
For , perform a two-sided test at level for and , either from the interval alone or by computing the test statistic (31.2).
-
3.
Perform a one-sided test for against at level . Why can the two-sided interval not be used for this test? Which confidence set corresponds to this test?