Chapter 9 compared two means. Most experiments compare several: three therapies, five antibiotics, four brands. Running every pair through a two-sample test fails in a precise way (the chance of at least one false alarm grows with the number of pairs), so the right first question is a single one: are all the means equal? The answer is a ratio of two variance estimates, one built from the spread of the group means and one from the spread inside the groups, which has an F law when the means are equal. This chapter develops that test, its law under the alternative (the noncentral F, which gives the power), Tukey's method for asking which means differ without inflating the error rate, contrasts for questions fixed before the data are seen, and transformations that repair unequal variances. The book states the main results and proves several; these notes add the missing arguments (the expected mean squares, the independence behind the F law, a Fisher's-lemma proof, the F test as a likelihood ratio test, the moment-generating function and the power of the noncentral law, the law of the Studentized range, the exact error rate of many pairwise tests, the partition of the treatment sum of squares into contrasts, what unequal variances do to the F test, and the delta method behind variance-stabilising transformations) and correct a few printing slips.
Course home Ch. 1 Introduction Ch. 2 Probability Ch. 3 Random variables Ch. 4 Special distributions Ch. 5 Estimation Ch. 6 Hypothesis testing Ch. 7 Normal-based inference Ch. 8 Types of data Ch. 9 Two-sample inference Ch. 10 Goodness of fit Ch. 11 Regression Ch. 12 Analysis of variance Ch. 13 Randomized blocks Ch. 14 Nonparametric statistics
Each Filling the gap box completes a step or a proof the book leaves out, and each selected question asks you to apply the chapter. Try it yourself first. When you are stuck, open Hint 1; the next hint unlocks one minute after you open the previous one, so take one hint at a time and think about it before moving on: the key idea first, then the tools, then the steps, with intermediate results to aim for. The full proof or solution appears after the last hint and unlocks two minutes later: use it to check your own argument. If you use a generative AI assistant, use it the same way: ask for a hint or for the next step only, then check what it says against these notes (why I teach this way). Spotted a mistake? Use the Report an error link at the end of each box: confirmed errors are corrected and listed, with thanks, in the errata.
They follow the book. Sections carry the book's numbers (12.1 to 12.6, with Appendix 12.A.1 placed inside Section 12.2 where its result is used and Appendix 12.A.2 as its own subsection at the end of it) and numbered items keep theirs (Theorem 12.2.5, Case Study 12.3.1, Question 12.4.3). Everything is written in new words; the book is cited for each result, example and figure, and numbered equations keep their number, e.g. \((12.2.4)\).
Filling the gaps. Wherever the book says "it can be shown", states a result without proof, leaves an exercise to the reader or defers to an appendix, an orange Filling the gap box gives the full argument. Proofs and derivations start hidden: open one with its bar, or use the button below. Each gap box and each selected question offers graded hints, one at a time, before the full solution.
Figures and demonstrations. Three figures of the chapter (12.2.2, 12.3.1 and 12.3.2) are reproduced; three own figures (x12.1 to x12.3) show the power of the F test, the true error rate of many pairwise tests, and what unequal variances and a square-root transformation do. The two tables of ANOVA layout (Figures 12.2.1 and 12.2.3) are typeset as tables here. All figures are computed by the Python code. The ▶ Demo boxes open an interactive demonstration already set to the case being discussed: two are new for this chapter and three first-year, graduate or other-course demonstrations are reused.
R. J. Larsen and M. L. Marx, An Introduction to Mathematical Statistics and Its Applications, 6th edition, Pearson (2018), Chapter 12, pages 580–612. Section, case-study, figure, equation and question numbers below refer to this book. Further reading is listed in the references.
The explanations, derivations, figures and code are my own; equations are cited by their numbers in the book.
The analysis of variance and multiple testing also appear, at other levels and in other words, in the companion courses of this site. Where a proof there is complete, these notes give the statement and a short sketch and link to it rather than repeating it.
Earlier chapters of this course: the normal-sample theorem, the \(\chi^2\) and \(F\) laws (Theorem 7.3.2, Definition 7.3.2) and Fisher's lemma with the Helmert matrix (Filling the gap 7.4); the noncentral \(t\) law and the power of the \(t\) test (Filling the gap 7.17); the decomposition \(\mathrm{SST}=\mathrm{SSB}+\mathrm{SSW}\) for \(k\) groups and the fact that for two levels \(F=t^2\) (Filling the gap 8.2, 8.10); the pooled \(t\) test as a likelihood ratio test (Filling the gap 9.2) and what unequal variances do to it (9.4).
New here: the expected mean squares, also for unequal variances (Filling the gap 12.1), the independence of \(\mathrm{SSE}\) and \(\mathrm{SSTR}\) (12.2), two proofs of the null law of \(\mathrm{SSTR}/\sigma^2\) (12.3, 12.4), the computing formulas (12.5), the \(F\) test as the likelihood ratio test (12.6), the noncentral \(\chi^2\) and \(F\) laws (12.7, 12.8), power and sample size (12.9), the law of the Studentized range (12.10), Theorem 12.3.1 in full (12.11), the exact error rate of many tests (12.12), the law of a contrast (12.13), the partition of \(\mathrm{SSTR}\) (12.14), planned against post hoc comparisons (12.15), rebuilding an analysis from summaries (12.16), unequal variances and non-normal data (12.17) and the delta method for transformations (12.18).
Notation. \(Y_{ij}\) is the \(i\)th observation at level \(j\) (\(i=1,\dots,n_j\), \(j=1,\dots,k\)), \(n=\sum n_j\), \(T_{\cdot j}=\sum_iY_{ij}\), \(\bar Y_{\cdot j}=T_{\cdot j}/n_j\), \(T_{\cdot\cdot}=\sum_jT_{\cdot j}\), \(\bar Y_{\cdot\cdot}=T_{\cdot\cdot}/n\) (the dot means "summed over"). \(\mu=\frac1n\sum n_j\mu_j\) is the overall mean. \(F_{p,\nu_1,\nu_2}\) has area \(p\) to its left under the \(F_{\nu_1,\nu_2}\) density (the book's notation, so \(F_{.95,3,20}=3.10\)); \(Q_{\alpha,k,\nu}\) is the upper-\(\alpha\) point of the Studentized range with \(k\) means and \(\nu\) degrees of freedom (the book's Table A.5, so \(Q_{.05,4,8}=4.53\)). Sums of squares are named as in the book: \(\mathrm{SSTR}\) (treatments), \(\mathrm{SSE}\) (error) and \(\mathrm{SSTOT}\); Chapter 8 called the same quantities SSB, SSW and SST.
Prerequisites. Section 7.3 for the \(\chi^2\), \(F\) and \(t\) laws and the normal-sample theorem, Section 8.2.3 for \(k\)-sample data, Chapter 9 for the two-sample case, Chapter 6 for tests, power and the likelihood ratio.
pp. 580–582 Chapter 9 compared two sets of measurements. The next step is to compare \(k\ge2\) of them. In a completely randomized one-factor design the experimenter picks \(k\) levels of one factor (three stop-smoking therapies, five crowding densities, four catalytic converters) and assigns each subject, at random, to one level. The data are \(k\) independent samples of sizes \(n_1,\dots,n_k\), total \(n=\sum n_j\), arranged as in Table 12.1.1 of the book: column \(j\) holds the observations \(Y_{1j},\dots,Y_{n_jj}\) of level \(j\), with total \(T_{\cdot j}\), mean \(\bar Y_{\cdot j}\) and unknown true mean \(\mu_j\). The book writes data as random variables (\(Y_{ij}\), not \(y_{ij}\)) from now on, and so do these notes.
The question is whether the factor matters at all: \[ H_0\colon\mu_1=\mu_2=\dots=\mu_k\qquad\text{against}\qquad H_1\colon\text{not all the }\mu_j\text{ are equal.}\] This is a \(k\)-sample location problem, the design called "\(k\)-sample data" in Section 8.2.3 (the smoking data of Case Study 8.1.1 are the example the book returns to in Section 12.2). The procedure is the analysis of variance (ANOVA), whose name comes from the form of its statistic, a ratio of variance estimates. It owes its shape to R. A. Fisher's work on agricultural field trials (Section 12.6 below), where differences between treatments were hidden by soil quality and drainage; its later sections of the book use the same idea for blocks (Chapter 13) and for two factors at once (Chapter 15).
After the test of \(H_0\) the book asks about subhypotheses, statements that involve only some of the means (\(H_0\colon\mu_i=\mu_j\) or \(H_0\colon\mu_3=(\mu_4+\mu_5)/2\)). Section 12.3 treats subhypotheses suggested by the data, Section 12.4 those fixed beforehand, and the two need different error rates.
See also (companion courses): the first-year comparison of two means, which this chapter extends; Statistical Methods for Modern Biology, Filling the gap 13.2 for the ANOVA identity.
pp. 582–591 The book could derive the test as a generalized likelihood ratio test, as in Chapters 7 and 9, but builds it on intuition instead; the likelihood ratio derivation is given in Filling the gap 12.6 and gives the same test. The model assumes that the \(Y_{ij}\) are independent and normal, \(Y_{ij}\sim\N(\mu_j,\sigma^2)\) with the same variance \(\sigma^2\) at every level. As in regression the assumption is written as a model equation, a fixed part plus noise: \[ Y_{ij}=\mu_j+\varepsilon_{ij},\qquad\varepsilon_{ij}\ \text{independent}\ \N(0,\sigma^2).\] Let \(\mu=\frac1n\sum_jn_j\mu_j\) be the overall mean (the common value of every \(\mu_j\) if \(H_0\) is true).
The maximum likelihood estimator of \(\mu_j\) is \(\bar Y_{\cdot j}\) (Example 5.2.4 of the book; notes), so \(\bar Y_{\cdot\cdot}=\frac1n\sum n_j\bar Y_{\cdot j}\) estimates \(\mu\). The treatment sum of squares \[ \mathrm{SSTR}=\sum_{j=1}^k\sum_{i=1}^{n_j}(\bar Y_{\cdot j}-\bar Y_{\cdot\cdot})^2=\sum_{j=1}^kn_j(\bar Y_{\cdot j}-\bar Y_{\cdot\cdot})^2\] measures how far apart the group means are: if all \(\mu_j\) are equal the \(\bar Y_{\cdot j}\) cluster around \(\bar Y_{\cdot\cdot}\) and \(\mathrm{SSTR}\) is small. Rewriting the deviations from \(\mu\) instead of \(\bar Y_{\cdot\cdot}\) gives \[ \mathrm{SSTR}=\sum_{j=1}^kn_j(\bar Y_{\cdot j}-\mu)^2-n(\bar Y_{\cdot\cdot}-\mu)^2,\tag{12.2.1}\] the form used to compute expectations and laws below (Filling the gap 12.1 proves it for every constant in place of \(\mu\)).
For \(k\) independent samples with \(\E Y_{ij}=\mu_j\) and \(\V Y_{ij}=\sigma^2\), \[ \E(\mathrm{SSTR})=(k-1)\sigma^2+\sum_{j=1}^kn_j(\mu_j-\mu)^2.\]
The second term is zero exactly when all the means are equal, and positive otherwise: so \(\mathrm{SSTR}/(k-1)\) is an unbiased estimator of \(\sigma^2\) under \(H_0\) and overestimates it under \(H_1\). That is why \(H_0\) should be rejected for a large \(\mathrm{SSTR}\).
The book proves Theorem 12.2.1 with the overall mean \(\mu\) and equal variances, and later states \(\E[\mathrm{SSTR}/(k-1)]\) in (12.2.3) (printed without the factor \(n_j\); see Notes on the book). Here is the version for any variances \(\sigma_j^2\): it is needed in Filling the gap 12.17, and it needs neither normality nor equal variances.
Every identity here is an algebra step on a sum of squares followed by \(\E Z^2=\V Z+(\E Z)^2\). Which quantity should you centre at, and what is the variance of \(\bar Y_{\cdot\cdot}\) when the groups have different variances?
Prove \(\mathrm{SSTR}=\sum n_j(\bar Y_{\cdot j}-m)^2-n(\bar Y_{\cdot\cdot}-m)^2\). Aim for: the cross term collapses because \(\sum n_j(\bar Y_{\cdot j}-m)=n(\bar Y_{\cdot\cdot}-m)\).
Take \(m=\mu\) and find \(\E(\bar Y_{\cdot j}-\mu)^2\) and \(\V\bar Y_{\cdot\cdot}\) with \(\bar Y_{\cdot\cdot}=\sum(n_j/n)\bar Y_{\cdot j}\). Aim for: \(\sigma_j^2/n_j+(\mu_j-\mu)^2\) and \(\sum n_j\sigma_j^2/n^2\).
Assemble \(\E\,\mathrm{SSTR}\), then \(\E\,\mathrm{SSE}=\sum(n_j-1)\sigma_j^2\), then divide by the degrees of freedom. Aim for: \(\sigma^2+\frac1{k-1}\sum n_j(\mu_j-\mu)^2\) for \(\E\,\mathrm{MSTR}\). When does the extra term vanish?
Let \(Y_{ij}\) be independent with \(\E Y_{ij}=\mu_j\), \(\V Y_{ij}=\sigma_j^2\), and \(\mu=\frac1n\sum n_j\mu_j\).
(a) The identity (12.2.1) for any constant \(m\). Write \(\bar Y_{\cdot j}-\bar Y_{\cdot\cdot}=(\bar Y_{\cdot j}-m)-(\bar Y_{\cdot\cdot}-m)\), square, multiply by \(n_j\) and add over \(j\): \[ \mathrm{SSTR}=\sum n_j(\bar Y_{\cdot j}-m)^2-2(\bar Y_{\cdot\cdot}-m)\sum n_j(\bar Y_{\cdot j}-m)+n(\bar Y_{\cdot\cdot}-m)^2.\] Since \(\sum n_j(\bar Y_{\cdot j}-m)=n(\bar Y_{\cdot\cdot}-m)\), the last two terms combine to \(-n(\bar Y_{\cdot\cdot}-m)^2\). Taking \(m=\mu\) gives (12.2.1).
(b) The mean of \(\mathrm{SSTR}\). Use \(m=\mu\) and \(\E Z^2=\V Z+(\E Z)^2\). The group mean \(\bar Y_{\cdot j}\) has mean \(\mu_j\) and variance \(\sigma_j^2/n_j\), so \(\E(\bar Y_{\cdot j}-\mu)^2=\sigma_j^2/n_j+(\mu_j-\mu)^2\). The overall mean \(\bar Y_{\cdot\cdot}=\sum(n_j/n)\bar Y_{\cdot j}\) is a combination of independent variables: its mean is \(\mu\) and its variance is \(\sum(n_j/n)^2\sigma_j^2/n_j=\sum n_j\sigma_j^2/n^2\). Hence \[ \E\,\mathrm{SSTR}=\sum_j\sigma_j^2+\sum_jn_j(\mu_j-\mu)^2-\sum_j\frac{n_j}n\sigma_j^2=\sum_j\Big(1-\frac{n_j}n\Big)\sigma_j^2+\sum_jn_j(\mu_j-\mu)^2.\] With a common variance, \(\sum_j(1-n_j/n)\sigma^2=(k-1)\sigma^2\), which is Theorem 12.2.1.
(c) The mean of \(\mathrm{SSE}\). \(\mathrm{SSE}=\sum_j(n_j-1)S_j^2\) and \(\E S_j^2=\sigma_j^2\) (Example 5.4.4; notes), so \(\E\,\mathrm{SSE}=\sum_j(n_j-1)\sigma_j^2\), which is \((n-k)\sigma^2\) for a common variance, whatever the means are.
(d) The mean squares. Dividing, \(\E\,\mathrm{MSE}=\sigma^2\) always, and \[ \E\frac{\mathrm{SSTR}}{k-1}=\sigma^2+\frac1{k-1}\sum_{j=1}^kn_j(\mu_j-\mu)^2,\] which is (12.2.3) with the weights \(n_j\) restored (the book's display omits them, which would be correct only for one observation per level). The second term vanishes if and only if every \(\mu_j=\mu\), because every \(n_j\ge1\). So under \(H_0\) both mean squares estimate \(\sigma^2\) and the ratio is near 1; under \(H_1\) only the numerator is inflated, and the ratio tends to exceed 1. ∎
Where each assumption was used: independence in the variance of \(\bar Y_{\cdot\cdot}\); the common variance only in simplifying the first sum; normality nowhere. The mean of the two mean squares is a statement about the numerator and denominator separately; it does not by itself say that \(F\) has an \(F\) law (it does not, if the variances differ, see Filling the gap 12.17).
Let the \(Y_{ij}\) be independent \(\N(\mu_j,\sigma^2)\). With \(S_j^2=\frac1{n_j-1}\sum_i(Y_{ij}-\bar Y_{\cdot j})^2\) put \(\mathrm{SSE}=\sum_j(n_j-1)S_j^2=\sum_j\sum_i(Y_{ij}-\bar Y_{\cdot j})^2\), the error sum of squares, and \(\mathrm{MSE}=\mathrm{SSE}/(n-k)\).
If \(\sigma^2\) were known, Theorem 12.2.2 would already give a test: reject \(H_0\) if \(\mathrm{SSTR}/\sigma^2\ge\chi^2_{1-\alpha,k-1}\). Since \(\sigma^2\) is almost never known, one divides by the estimate \(\mathrm{MSE}\) and gets an \(F\) law instead. The book proves Theorem 12.2.3 in four lines and defers Theorem 12.2.2 to Appendix 12.A.1; the three boxes below fill in both proofs (the moment-generating function argument of the appendix, and the Fisher's lemma argument that Question 12.2.10 asks for).
Theorem 12.2.3 combines the normal-sample theorem for each level with the independence of the \(k\) samples. The step to check is that all the group means and all the group variances are mutually independent, not only each mean with its own variance.
A ratio of two quantities has an \(F\) law only if they are independent chi-squared variables. Which statistics of the \(k\) samples feed \(\mathrm{SSE}\), which feed \(\mathrm{SSTR}\), and why are the two groups of statistics independent?
Argue that \(\bar Y_{\cdot1},\dots,\bar Y_{\cdot k},S_1^2,\dots,S_k^2\) are mutually independent. Aim for: a joint density that is a product over \(j\), each factor itself a product.
Write \(\mathrm{SSE}/\sigma^2=\sum(n_j-1)S_j^2/\sigma^2\) and add the \(k\) independent \(\chi^2\) laws. Aim for: \(\chi^2_{n-k}\) with no use of \(H_0\).
Say which variables \(\mathrm{SSTR}\) and \(\mathrm{SSE}\) are functions of. Aim for: independence of the two sums of squares, and of \(\mathrm{SSE}\) and \(\bar Y_{\cdot\cdot}\).
By the normal-sample theorem (Theorem 7.3.2), for each \(j\) the sample mean \(\bar Y_{\cdot j}\) and sample variance \(S_j^2\) are independent and \((n_j-1)S_j^2/\sigma^2\sim\chi^2_{n_j-1}\). The \(k\) samples are independent, so the \(k\) pairs \((\bar Y_{\cdot j},S_j^2)\) are independent; the joint density of the \(2k\) variables is the product of the pair densities, and each pair density is itself a product. Hence \(\bar Y_{\cdot1},\dots,\bar Y_{\cdot k},S_1^2,\dots,S_k^2\) are mutually independent.
The law of \(\mathrm{SSE}\). \(\mathrm{SSE}/\sigma^2=\sum_j(n_j-1)S_j^2/\sigma^2\) is a sum of \(k\) independent chi-squared variables with \(n_j-1\) degrees of freedom, so it is chi-squared with \(\sum(n_j-1)=n-k\) degrees of freedom (the degrees of freedom add, Theorem 4.6.4). Nothing here used \(H_0\): the group means \(\mu_j\) cancel in each \(S_j^2\). The count \(n-k\) is the number of observations minus the \(k\) group means estimated.
Independence. \(\mathrm{SSTR}=\sum n_j(\bar Y_{\cdot j}-\bar Y_{\cdot\cdot})^2\) is a function of \((\bar Y_{\cdot1},\dots,\bar Y_{\cdot k})\) only (\(\bar Y_{\cdot\cdot}\) is a weighted average of them) and \(\mathrm{SSE}\) a function of \((S_1^2,\dots,S_k^2)\) only. Functions of disjoint sets of mutually independent variables are independent (Filling the gap 3.14). So \(\mathrm{SSE}\) is independent of \(\mathrm{SSTR}\), and of \(\bar Y_{\cdot\cdot}\), under \(H_0\) or \(H_1\). Taking the mean of \(\chi^2_{n-k}\), \(\E\,\mathrm{MSE}=\sigma^2\). ∎
This independence is what makes the ratio \(F\) have an \(F\) law: numerator and denominator must be independent. It is special to normal samples; for other laws a sample mean and variance are not independent.
The appendix shows that \(\mathrm{SSTR}/\sigma^2\) has the moment-generating function of \(\chi^2_{k-1}\) by dividing the mgf of \(\mathrm{SSTOT}/\sigma^2\) by that of \(\mathrm{SSE}/\sigma^2\). Two things need saying: where \(H_0\) is used, and why the division is allowed.
Under \(H_0\) the total sum of squares is a single chi-squared variable, and it equals the sum of two independent pieces, one of which you know. What does independence do to moment-generating functions, and what lets you divide?
Under \(H_0\), identify the law of \(\mathrm{SSTOT}/\sigma^2\). Aim for: \(\chi^2_{n-1}\), because all \(n\) observations are one normal sample.
Take mgfs of both sides of \(\mathrm{SSTOT}=\mathrm{SSTR}+\mathrm{SSE}\), divided by \(\sigma^2\). Aim for: \((1-2t)^{-(n-1)/2}=M_{\mathrm{SSTR}/\sigma^2}(t)\,(1-2t)^{-(n-k)/2}\).
Justify the division for \(t<\frac12\), then read the exponent. Aim for: \((1-2t)^{-(k-1)/2}\), so \(\chi^2_{k-1}\). Where exactly was \(H_0\) used?
Step 1 (uses \(H_0\)). If all \(\mu_j=\mu\), the \(n\) observations form one random sample from \(\N(\mu,\sigma^2)\), and \(\mathrm{SSTOT}=\sum_{j,i}(Y_{ij}-\bar Y_{\cdot\cdot})^2=(n-1)S^2\) with \(S^2\) the sample variance of all \(n\) observations. By Theorem 7.3.2, \(\mathrm{SSTOT}/\sigma^2\sim\chi^2_{n-1}\), with mgf \((1-2t)^{-(n-1)/2}\) for \(t<\tfrac12\).
Step 2. \(\mathrm{SSTOT}=\mathrm{SSTR}+\mathrm{SSE}\) (Theorem 12.2.4, below), and \(\mathrm{SSTR}\) and \(\mathrm{SSE}\) are independent (Filling the gap 12.2), so the mgf of the sum is the product of the mgfs: \[ (1-2t)^{-(n-1)/2}=M_{\mathrm{SSTR}/\sigma^2}(t)\cdot(1-2t)^{-(n-k)/2},\qquad t<\tfrac12,\] where \(\mathrm{SSE}/\sigma^2\sim\chi^2_{n-k}\) was used (this holds under \(H_0\) or not).
Step 3 (the division). For \(t<\frac12\) the factor \((1-2t)^{-(n-k)/2}\) is finite and positive, so we may divide both sides by it: \[ M_{\mathrm{SSTR}/\sigma^2}(t)=(1-2t)^{-(n-1)/2+(n-k)/2}=(1-2t)^{-(k-1)/2},\qquad t<\tfrac12.\] This is the mgf of \(\chi^2_{k-1}\), finite on an interval around 0, and an mgf finite near 0 determines the law (Theorem 3.12.2). Hence \(\mathrm{SSTR}/\sigma^2\sim\chi^2_{k-1}\). ∎
Without \(H_0\), step 1 fails: \(\mathrm{SSTOT}\) then contains the spread of the true means and is not a multiple of a \(\chi^2_{n-1}\) variable. The same argument with the mgf of the noncentral \(\chi^2\) (Filling the gap 12.7) reappears in 12.8, where the direct route of the next box is used instead.
The mgf proof is short but only identifies the law. A rotation of the standardised group means shows why it is \(\chi^2_{k-1}\): \(\mathrm{SSTR}/\sigma^2\) is the squared length of a standard normal vector in a \((k-1)\)-dimensional space. The same construction handles the non-null case in Filling the gap 12.8.
Standardise the \(k\) group means and rotate them so that one coordinate is the overall mean. If the rotated coordinates are again independent standard normal, what is \(\mathrm{SSTR}/\sigma^2\) in terms of them?
Put \(W_j=\sqrt{n_j}(\bar Y_{\cdot j}-\mu)/\sigma\) and write \(\mathrm{SSTR}/\sigma^2\) with (12.2.1). Aim for: \(\sum W_j^2-\big(\sqrt n(\bar Y_{\cdot\cdot}-\mu)/\sigma\big)^2\).
Choose an orthogonal \(A\) with first row \((\sqrt{n_1/n},\dots,\sqrt{n_k/n})\) and put \(\bm V=A\bm W\). Aim for: \(V_1\) equal to the standardised overall mean.
Use that lengths are preserved. Aim for: \(\mathrm{SSTR}/\sigma^2=V_2^2+\dots+V_k^2\sim\chi^2_{k-1}\), independent of \(V_1\) and of \(\mathrm{SSE}\).
Assume \(H_0\). Put \(W_j=\sqrt{n_j}\,(\bar Y_{\cdot j}-\mu)/\sigma\). The \(W_j\) are independent and \(\N(0,1)\). By (12.2.1) divided by \(\sigma^2\), \[ \frac{\mathrm{SSTR}}{\sigma^2}=\sum_{j=1}^kW_j^2-\Big(\frac{\bar Y_{\cdot\cdot}-\mu}{\sigma/\sqrt n}\Big)^2 .\] The rotation. Let \(\bm a_1=(\sqrt{n_1/n},\dots,\sqrt{n_k/n})\), a unit vector. The vectors \(\bm a_1,\bm e_1,\dots,\bm e_{k-1}\) (the first \(k-1\) coordinate vectors) are linearly independent, because only \(\bm a_1\) has a nonzero last coordinate; the Gram–Schmidt process turns them into an orthonormal basis \(\bm a_1,\dots,\bm a_k\) of \(\R^k\). Let \(A\) have rows \(\bm a_1,\dots,\bm a_k\); it is an orthogonal matrix. Put \(\bm V=A\bm W\). By Fisher's lemma (the change of variables of Filling the gap 7.4: \(\bm W\) has the rotation-invariant density \((2\pi)^{-k/2}e^{-\|\bm w\|^2/2}\) and \(|\det A|=1\)), \(V_1,\dots,V_k\) are independent \(\N(0,1)\).
Reading off. The first coordinate is \(V_1=\sum_j\sqrt{n_j/n}\,W_j=\frac1{\sigma\sqrt n}\sum_jn_j(\bar Y_{\cdot j}-\mu)=\dfrac{\bar Y_{\cdot\cdot}-\mu}{\sigma/\sqrt n}\), the standardised overall mean. An orthogonal matrix preserves lengths, \(\sum V_j^2=\sum W_j^2\), so \[ \frac{\mathrm{SSTR}}{\sigma^2}=\sum_{j=1}^kV_j^2-V_1^2=\sum_{j=2}^kV_j^2 .\] This is a sum of \(k-1\) squares of independent standard normal variables, which is \(\chi^2_{k-1}\) by definition. It is also independent of \(V_1\), that is of \(\bar Y_{\cdot\cdot}\), and (by Filling the gap 12.2) of \(\mathrm{SSE}\). ∎
The geometry. Viewed in \(\R^n\), the vector of observations is split into three orthogonal pieces: the overall mean (dimension 1), the deviations of group means from the overall mean (dimension \(k-1\), length squared \(\mathrm{SSTR}\)) and the deviations within groups (dimension \(n-k\), length squared \(\mathrm{SSE}\)). These dimensions are the degrees of freedom \(1\), \(k-1\), \(n-k\) and they add to \(n\); the Pythagorean identity is Theorem 12.2.4 (Filling the gap 8.2).
With \(\mathrm{SSTOT}=\sum_{j}\sum_i(Y_{ij}-\bar Y_{\cdot\cdot})^2\), for any data (no distribution needed), \[ \mathrm{SSTOT}=\mathrm{SSTR}+\mathrm{SSE}.\]
The book's proof adds and subtracts \(\bar Y_{\cdot j}\) and notes that the cross term vanishes because deviations from a group mean sum to zero. The same identity, with the same one-line proof and the reading "total \(=\) between \(+\) within", is proved in Filling the gap 8.2; it is not repeated here.
Let the \(Y_{ij}\) be independent \(\N(\mu_j,\sigma^2)\). If \(H_0\colon\mu_1=\dots=\mu_k\) is true, \[ F=\frac{\mathrm{SSTR}/(k-1)}{\mathrm{SSE}/(n-k)}\sim F_{k-1,n-k},\] and at level \(\alpha\) one rejects \(H_0\) if \(F\ge F_{1-\alpha,k-1,n-k}\).
Part (a) is Definition 7.3.2 of the \(F\) law applied to the independent \(\chi^2\) variables of Theorems 12.2.2 and 12.2.3 (Definition 7.3.2). Part (b), the position of the critical region, rests on Theorem 12.2.1: the numerator has mean \(\sigma^2+\frac1{k-1}\sum n_j(\mu_j-\mu)^2\) and the denominator \(\sigma^2\), so \(F\) is near 1 under \(H_0\) and tends to be large under \(H_1\). That heuristic is made exact in Filling the gap 12.9: under \(H_1\) the ratio is stochastically larger, the more so the farther the means are apart, so the one-sided right-tail region is the right one. The test is also the likelihood ratio test (Filling the gap 12.6).
All the quantities are collected in the layout of Figure 12.2.1 of the book, the ANOVA table:
| Source | df | SS | MS | \(F\) | \(P\) |
|---|---|---|---|---|---|
| Treatment | \(k-1\) | SSTR | \(\mathrm{MSTR}=\mathrm{SSTR}/(k-1)\) | \(\mathrm{MSTR}/\mathrm{MSE}\) | \(\P(F_{k-1,n-k}\ge F_{\mathrm{obs}})\) |
| Error | \(n-k\) | SSE | \(\mathrm{MSE}=\mathrm{SSE}/(n-k)\) | ||
| Total | \(n-1\) | SSTOT |
Each row is a source of variation of the model equation; the rows above "Total" add up to it, both in sums of squares and in degrees of freedom (\(n-1=(k-1)+(n-k)\)).
The data of Case Study 8.1.1 (Table 12.2.1 of the book) give the heart rate three minutes after exercise for six subjects in each of four groups: nonsmokers, light, moderate and heavy smokers. The group totals are \(T_{\cdot j}=374,\ 379,\ 430,\ 490\), the means \(\bar y_{\cdot j}=62.33,\ 63.17,\ 71.67,\ 81.67\) (the book prints 62.3, 63.2, 71.7, 81.7) and the overall mean \(\bar y_{\cdot\cdot}=1673/24=69.71\). With \(k=4\), \(n=24\) and \(\alpha=0.05\) the test rejects \(H_0\colon\mu_1=\mu_2=\mu_3=\mu_4\) if \(F\ge F_{.95,3,20}=3.10\) (Figure 12.2.2). Here \[ \mathrm{SSTR}=6\big[(62.33-69.71)^2+(63.17-69.71)^2+(71.67-69.71)^2+(81.67-69.71)^2\big]=1464.125,\qquad \mathrm{SSE}=1594.833,\] so \(F=\dfrac{1464.125/3}{1594.833/20}=\dfrac{488.04}{79.74}=6.12\) and \(H_0\) is rejected (\(P=0.0040\)): smoking status is associated with the heart rate. The ANOVA table (Figure 12.2.3 of the book):
| Source | df | SS | MS | \(F\) | \(P\) |
|---|---|---|---|---|---|
| Treatment | 3 | 1464.125 | 488.04 | 6.12 | 0.004 |
| Error | 20 | 1594.833 | 79.74 | ||
| Total | 23 | 3058.958 |
The test says the means are not all equal; it does not say which differ (Section 12.3) and, because the subjects chose their own smoking habit, nothing about causation (Section 8.1.3).
fig_12_2_2.p. 588 With \(C=T_{\cdot\cdot}^2/n\) ("the correction for the mean"), \[ \mathrm{SSTOT}=\sum_{j=1}^k\sum_{i=1}^{n_j}Y_{ij}^2-C\tag{12.2.4}\] \[ \mathrm{SSTR}=\sum_{j=1}^k\frac{T_{\cdot j}^2}{n_j}-C\tag{12.2.5}\] and \(\mathrm{SSE}=\mathrm{SSTOT}-\mathrm{SSTR}\) by Theorem 12.2.4. The book leaves the proofs of (12.2.4) and (12.2.5) as exercises (Question 12.2.9).
Both are one expansion of the square plus the identities \(\sum_{j,i}Y_{ij}=T_{\cdot\cdot}=n\bar Y_{\cdot\cdot}\) and \(\sum_iY_{ij}=T_{\cdot j}=n_j\bar Y_{\cdot j}\). A warning about the arithmetic follows.
Both formulas come from expanding one square and replacing sums by totals. Which two sums do you need, and what does a constant shift do to the answer?
Expand \(\sum(Y_{ij}-\bar Y_{\cdot\cdot})^2\). Aim for: \(\sum Y_{ij}^2-2n\bar Y_{\cdot\cdot}^2+n\bar Y_{\cdot\cdot}^2=\sum Y_{ij}^2-C\).
Expand \(\sum n_j(\bar Y_{\cdot j}-\bar Y_{\cdot\cdot})^2\), using \(n_j\bar Y_{\cdot j}^2=T_{\cdot j}^2/n_j\). Aim for: \(\sum T_{\cdot j}^2/n_j-C\).
Show that subtracting a constant from every observation leaves \(\mathrm{SSTOT}\) and \(\mathrm{SSTR}\) unchanged, and use it to recompute Example 12.2.1 with small numbers.
(12.2.4). \(\sum_{j,i}(Y_{ij}-\bar Y_{\cdot\cdot})^2=\sum_{j,i}Y_{ij}^2-2\bar Y_{\cdot\cdot}\sum_{j,i}Y_{ij}+n\bar Y_{\cdot\cdot}^2=\sum_{j,i}Y_{ij}^2-2n\bar Y_{\cdot\cdot}^2+n\bar Y_{\cdot\cdot}^2=\sum_{j,i}Y_{ij}^2-n\bar Y_{\cdot\cdot}^2\), and \(n\bar Y_{\cdot\cdot}^2=T_{\cdot\cdot}^2/n=C\).
(12.2.5). \(\sum_jn_j(\bar Y_{\cdot j}-\bar Y_{\cdot\cdot})^2=\sum_jn_j\bar Y_{\cdot j}^2-2\bar Y_{\cdot\cdot}\sum_jn_j\bar Y_{\cdot j}+\bar Y_{\cdot\cdot}^2\sum_jn_j=\sum_j\frac{T_{\cdot j}^2}{n_j}-2n\bar Y_{\cdot\cdot}^2+n\bar Y_{\cdot\cdot}^2=\sum_j\frac{T_{\cdot j}^2}{n_j}-C\), using \(n_j\bar Y_{\cdot j}^2=T_{\cdot j}^2/n_j\). ∎
Example 12.2.1. For the heart-rate data the grand total is \(374+379+430+490=1673\), so \(C=1673^2/24=116{,}622.04\); with \(\sum Y_{ij}^2=119{,}681\) we get \(\mathrm{SSTOT}=3058.96\), then \(\mathrm{SSTR}=374^2/6+379^2/6+430^2/6+490^2/6-C=1464.13\) and \(\mathrm{SSE}=1594.83\), the numbers of Case Study 12.2.1.
A numerical warning. The shortcut subtracts two large nearly equal numbers (119,681 and 116,622), and with data like 1000.1, 1000.3, ... it destroys the significant digits. The sums of squares are unchanged if every observation is shifted by a constant \(a\) (all deviations from means are unchanged) and multiplied by \(b^2\) if every observation is multiplied by \(b\). So code the data first, e.g. subtract 70 from every heart rate: the coded totals are \(-46,-41,10,70\), \(C=(-7)^2/24=2.04\), and the same sums of squares follow with small numbers.
See also (companion courses): Statistical Methods for Modern Biology, Filling the gap 13.2 (the ANOVA identity in matrix form).
The book says a GLRT could be done "and the benefits would be marginal". It is short, and it explains where the statistic comes from: \(\lambda\) is a decreasing function of \(F\).
Both maximised normal likelihoods look like \((2\pi e\hat\sigma^2)^{-n/2}\), so \(\lambda\) is a power of a ratio of two sums of squares. Which two, and how does that ratio depend on \(F\)?
Maximise over \(\Omega\) (separate means) and over \(\omega\) (one mean). Aim for: residual sums of squares \(\mathrm{SSE}\) and \(\mathrm{SSTOT}\).
Form \(\lambda\) and rewrite \(\lambda^{2/n}\) with \(\mathrm{SSTR}/\mathrm{SSE}=\frac{k-1}{n-k}F\). Aim for: \(\lambda^{2/n}=\dfrac{n-k}{(n-k)+(k-1)F}\).
Conclude that \(\lambda\le\lambda^*\) is \(F\ge c\), and fix \(c\) from the null law of \(F\). Check the case \(k=2\) against \(F=t^2\).
The likelihood of independent \(Y_{ij}\sim\N(\mu_j,\sigma^2)\) is \(L=(2\pi\sigma^2)^{-n/2}\exp\{-\frac1{2\sigma^2}\sum_{j,i}(Y_{ij}-\mu_j)^2\}\). For fixed \(\sigma^2\) it is largest where the sum of squares is smallest, at \(\mu_j=\bar Y_{\cdot j}\); maximising over \(\sigma^2\) the function \(-\frac n2\ln\sigma^2-\frac{SS}{2\sigma^2}\) gives \(\hat\sigma^2=SS/n\), with maximum \((2\pi e\,SS/n)^{-n/2}\).
Unrestricted (\(\Omega\): \(k+1\) free parameters): \(SS=\sum(Y_{ij}-\bar Y_{\cdot j})^2=\mathrm{SSE}\). Restricted (\(\omega\): one common mean \(\mu\) and \(\sigma^2\)): the sum of squares is minimised at the grand mean and equals \(\mathrm{SSTOT}\). So \[ \lambda=\frac{L(\hat\omega)}{L(\hat\Omega)}=\Big(\frac{\mathrm{SSE}}{\mathrm{SSTOT}}\Big)^{n/2},\qquad\lambda^{2/n}=\frac{\mathrm{SSE}}{\mathrm{SSE}+\mathrm{SSTR}}=\frac{n-k}{(n-k)+(k-1)F}.\] The last step divides numerator and denominator by \(\mathrm{SSE}\) and uses \(\mathrm{SSTR}/\mathrm{SSE}=\frac{k-1}{n-k}F\). Hence \(\lambda\) is a strictly decreasing function of \(F\), and \(\lambda\le\lambda^*\) (\(0<\lambda^*<1\)) is the event \(F\ge c\) for a constant \(c\). Under \(H_0\), \(F\sim F_{k-1,n-k}\) (Theorem 12.2.5), so size \(\alpha\) requires \(c=F_{1-\alpha,k-1,n-k}\). The GLRT and the \(F\) test coincide. ∎
For the heart-rate data \(\lambda=(1594.83/3058.96)^{12}=0.0004\). For \(k=2\), \(F=t^2\) and \(\lambda^{2/n}=\frac{n-2}{n-2+t^2}\), equation (9.A.1.5) of Filling the gap 9.2. So the one-way ANOVA is the likelihood ratio test for \(k\) normal means with a common variance, as the pooled \(t\) test is for two.
With \(k=2\), samples \(X_1,\dots,X_n\) and \(Y_1,\dots,Y_m\), the book computes \(\mathrm{SSTR}=\frac{nm}{n+m}(\bar X-\bar Y)^2\) and \(\mathrm{SSE}=(n+m-2)S_p^2\), so that \(F=\dfrac{(\bar X-\bar Y)^2}{S_p^2(1/n+1/m)}=T^2\), the square of the pooled \(t\) statistic of Theorem 9.2.2; and \(F_{1-\alpha,1,n+m-2}=t_{\alpha/2,n+m-2}^2\), so the two rejection regions are the same event. The identical computation, set in the "SSB and SSW" notation, is Filling the gap 8.10 (with the paired-data version), and the likelihood ratio form is Filling the gap 9.2; they are not repeated here. Two consequences: for \(k=2\) the \(F\) test can only detect a two-sided difference, and the one-sided \(t\) tests of Theorem 9.2.2 have no \(F\) counterpart. For the Twain–Snodgrass data of Case Study 9.2.1 the ANOVA gives \(F=15.04=3.878^2\) (Question 12.2.12).
See also (companion courses): first-year pooled or Welch demo for the two-group test that this one generalizes.
pp. 608–612 Theorem 12.2.5 gives the law of the ratio when the means are equal. To find the probability of a Type II error, or the power \(\P(F\ge F_{1-\alpha,k-1,n-k}\mid H_1)\), one needs its law when they are not. It is a noncentral \(F\) law, built from a noncentral \(\chi^2\) law exactly as the central \(F\) law is built from central \(\chi^2\) laws.
Let \(V_1,\dots,V_r\) be independent, \(V_j\sim\N(\mu_j,1)\). Then \(V=\sum_{j=1}^rV_j^2\) has the noncentral \(\chi^2\) law with \(r\) degrees of freedom and noncentrality parameter \(\gamma=\sum_{j=1}^r\mu_j^2\). Write \(V\sim\chi'^2_r(\gamma)\). For \(\gamma=0\) it is the ordinary \(\chi^2_r\).
\(M_V(t)=(1-2t)^{-r/2}\exp\Big\{\dfrac{\gamma t}{1-2t}\Big\}\) for \(t<\tfrac12\).
The book completes a square inside a normal integral for one term and multiplies the mgfs for \(r\) terms. Here is the one-term integral with each line of the algebra, followed by what the mgf gives: the mean \(r+\gamma\), the variance \(2r+4\gamma\), and the sum rule.
Start with one squared normal variable with mean \(\mu\): the exponent of its mgf integral is a quadratic in \(z\), so complete the square. The general case is a product, and the mean and variance come from derivatives of the log of the mgf.
Write \(M_{V^2}(t)=\int(2\pi)^{-1/2}\exp\{t(z+\mu)^2-z^2/2\}\d z\) and complete the square with \(s=1-2t\). Aim for: exponent \(-\frac s2(z-\frac{2t\mu}s)^2+\frac{\mu^2t}{1-2t}\).
Evaluate the remaining normal integral and multiply over \(j\). Aim for: \((1-2t)^{-r/2}\exp\{\gamma t/(1-2t)\}\).
Differentiate \(K(t)\) twice at 0. Aim for: mean \(r+\gamma\), variance \(2r+4\gamma\); then use products of mgfs for the sum rule of Question 12.A.2.5.
One term. Let \(Z\sim\N(0,1)\), \(V=Z+\mu\). For \(t<\frac12\), \[ M_{V^2}(t)=\E e^{t(Z+\mu)^2}=\int_{-\infty}^\infty\frac{1}{\sqrt{2\pi}}\exp\Big\{t(z+\mu)^2-\frac{z^2}2\Big\}\d z.\] The exponent is \(-\tfrac12(1-2t)z^2+2t\mu z+t\mu^2\). Complete the square in \(z\): with \(s=1-2t>0\), \[ -\tfrac s2z^2+2t\mu z=-\tfrac s2\Big(z-\frac{2t\mu}{s}\Big)^2+\frac{2t^2\mu^2}{s},\] so the exponent equals \(-\frac s2(z-\frac{2t\mu}s)^2+\mu^2\big(t+\frac{2t^2}{s}\big)\), and \(t+\frac{2t^2}{1-2t}=\frac{t(1-2t)+2t^2}{1-2t}=\frac t{1-2t}\). The remaining integral is that of a normal density with variance \(1/s\) (unnormalised), equal to \(s^{-1/2}\sqrt{2\pi}\). So \[ M_{V^2}(t)=(1-2t)^{-1/2}\exp\Big\{\frac{\mu^2t}{1-2t}\Big\}.\] Several terms. For independent \(V_j\sim\N(\mu_j,1)\) the mgf of \(\sum V_j^2\) is the product (Theorem 3.12.3): \((1-2t)^{-r/2}\exp\{\frac{t}{1-2t}\sum\mu_j^2\}\), which is the claim with \(\gamma=\sum\mu_j^2\). ∎
Consequences. (a) The mgf depends on \((\mu_1,\dots,\mu_r)\) only through \(\gamma\), so by uniqueness the law depends on them only through \(\gamma\) (any rotation of the mean vector gives the same law). (b) Let \(K(t)=\ln M_V(t)=-\frac r2\ln(1-2t)+\frac{\gamma t}{1-2t}\). Then \(K'(t)=\frac r{1-2t}+\frac{\gamma}{(1-2t)^2}\) and \(K''(t)=\frac{2r}{(1-2t)^2}+\frac{4\gamma}{(1-2t)^3}\), so \[ \E V=K'(0)=r+\gamma,\qquad\V V=K''(0)=2r+4\gamma.\] This is Question 12.A.2.3, and \(\gamma=\E V-r\) is Question 12.A.2.4 (also seen directly: \(\E V_j^2=1+\mu_j^2\)). (c) If \(V_1,\dots,V_m\) are independent with \(V_i\sim\chi'^2_{r_i}(\gamma_i)\), the product of the mgfs is the mgf of \(\chi'^2_{\sum r_i}(\sum\gamma_i)\), so \(V=\sum V_i\sim\chi'^2_{\sum r_i}(\sum\gamma_i)\) (Question 12.A.2.5). Degrees of freedom and noncentrality both add.
If \(V_1\sim\chi'^2_{r_1}(\gamma)\) and \(V_2\sim\chi^2_{r_2}\) are independent, \(\dfrac{V_1/r_1}{V_2/r_2}\) has the noncentral \(F\) law with \(r_1\) and \(r_2\) degrees of freedom and noncentrality \(\gamma\): \(F'_{r_1,r_2}(\gamma)\).
For independent \(Y_{ij}\sim\N(\mu_j,\sigma^2)\) (the means need not be equal), \(F=\dfrac{\mathrm{SSTR}/(k-1)}{\mathrm{SSE}/(n-k)}\sim F'_{k-1,n-k}(\gamma)\) with \[ \gamma=\frac1{\sigma^2}\sum_{j=1}^kn_j(\mu_j-\mu)^2,\qquad\mu=\frac1n\sum n_j\mu_j.\]
The proof is the rotation of Filling the gap 12.4, now applied to normal variables whose means are not zero. The book states that the rotated coordinates are normal with variance one, but also needs that they are independent and what their means are; both follow from one covariance computation.
Use the rotation of gap 12.4 again, now with normal variables whose means are not zero. What are the mean vector and covariance matrix of the rotated vector, and what is the mean of its first coordinate?
Standardise: \(W_j\sim\N(m_j,1)\) with \(m_j=\sqrt{n_j}(\mu_j-\mu)/\sigma\). Aim for: \(\bm W\sim\N(\bm m,I)\) and \(\mathrm{SSTR}/\sigma^2=\sum W_j^2-V_1^2\).
Rotate, \(\bm V=A\bm W\), and find its mean and covariance. Aim for: independent \(V_j\sim\N((A\bm m)_j,1)\) with \((A\bm m)_1=0\).
Sum \(V_2^2+\dots+V_k^2\) and compute \(\sum_{j\ge2}(A\bm m)_j^2\) using \(\|A\bm m\|=\|\bm m\|\). Aim for: \(\gamma=\sum n_j(\mu_j-\mu)^2/\sigma^2\); then divide by the independent \(\chi^2_{n-k}\).
The standardised means. Put \(W_j=\sqrt{n_j}(\bar Y_{\cdot j}-\mu)/\sigma\). The \(W_j\) are independent normal with variance \(n_j\cdot\frac{\sigma^2}{n_j}/\sigma^2=1\) and mean \(m_j=\sqrt{n_j}(\mu_j-\mu)/\sigma\); write \(\bm W\sim\N(\bm m,I_k)\). As in (12.2.1), \(\mathrm{SSTR}/\sigma^2=\sum W_j^2-V_1^2\) with \(V_1=\sqrt n(\bar Y_{\cdot\cdot}-\mu)/\sigma\).
The rotation. Take the orthogonal matrix \(A\) of Filling the gap 12.4, first row \(\bm a_1=(\sqrt{n_1/n},\dots,\sqrt{n_k/n})\), and \(\bm V=A\bm W\). A linear map of a normal vector is a normal vector, with mean \(A\bm m\) and covariance \(AI_kA^\T=I_k\). Uncorrelated jointly normal variables are independent, so \(V_1,\dots,V_k\) are independent \(\N((A\bm m)_j,1)\).
The mean of \(V_1\). \((A\bm m)_1=\bm a_1\cdot\bm m=\sum_j\sqrt{n_j/n}\,\sqrt{n_j}(\mu_j-\mu)/\sigma=\frac{1}{\sigma\sqrt n}\sum_jn_j(\mu_j-\mu)=0\), by the definition of \(\mu\). So \(V_1\sim\N(0,1)\), consistent with \(V_1=\sqrt n(\bar Y_{\cdot\cdot}-\mu)/\sigma\), whose mean is \(\sqrt n(\mu-\mu)/\sigma=0\).
The law of \(\mathrm{SSTR}/\sigma^2\). Lengths are preserved, \(\sum_jV_j^2=\sum_jW_j^2\), so \[ \frac{\mathrm{SSTR}}{\sigma^2}=\sum_{j=1}^kV_j^2-V_1^2=\sum_{j=2}^kV_j^2,\] a sum of squares of \(k-1\) independent unit-variance normal variables with means \((A\bm m)_j\), \(j\ge2\). By Definition 12.A.2.1 it is \(\chi'^2_{k-1}(\gamma)\) with \(\gamma=\sum_{j\ge2}(A\bm m)_j^2=\|A\bm m\|^2-(A\bm m)_1^2=\|\bm m\|^2-0=\sum_jn_j(\mu_j-\mu)^2/\sigma^2\). (The book reaches the same number as \(\E\sum_{j\ge2}V_j^2-(k-1)\), by Question 12.A.2.4, after noting each \(V_j\) is normal with variance one; the independence of the \(V_j\) is what makes the sum a noncentral \(\chi^2\) in the first place.)
The ratio. \(\mathrm{SSE}/\sigma^2\sim\chi^2_{n-k}\) is independent of all the \(\bar Y_{\cdot j}\), hence of \(\bm V\) and of \(\mathrm{SSTR}\) (Filling the gap 12.2). By Definition 12.A.2.2 the ratio \(F\) is \(F'_{k-1,n-k}(\gamma)\). ∎
For \(\gamma=0\), that is all \(\mu_j=\mu\), this reproduces Theorems 12.2.2 and 12.2.5. Notice that \(\sigma^2\) enters only in \(\gamma\): the test depends on how large the differences between means are relative to the noise, and on the group sizes through the weights \(n_j\). The mean of \(\mathrm{MSTR}/\sigma^2\) is \(1+\gamma/(k-1)\), which is Theorem 12.2.1 restated.
fig_x12_1.The book's Comment says that as \(H_1\) moves away from \(H_0\) "the noncentral \(F\) shifts to the right" and the power increases to 1, and refers the reader to tables. Here is the proof, and what it says about planning an experiment. With it, the right-tail critical region of Theorem 12.2.5 is justified: the test is unbiased.
Write a noncentral \(\chi^2\) variable as \((Z_1+\sqrt\gamma)^2+\)(a central \(\chi^2\)). Then the dependence of the power on \(\gamma\) is only through one squared shifted normal: how does \(\P((Z+a)^2\ge x)\) change with \(a\)?
Show the representation by comparing mgfs, then write the power as \(\E\,h(\sqrt\gamma,X)\) with \(X\) independent of \(Z_1\). Aim for: \(X\) free of \(\gamma\).
Differentiate \(h\) in \(a\). Aim for: \(\varphi(\sqrt x-a)-\varphi(\sqrt x+a)\ge0\), with a reason for the sign.
Deduce that the power increases with \(\gamma\), equals \(\alpha\) at \(\gamma=0\) and tends to 1. Aim for: the test is unbiased.
For equal group sizes compute \(\gamma=r\sum(\mu_j-\mu)^2/\sigma^2\) for each pattern of means. Aim for: compare the sums of squared deviations, not the ranges.
A representation. If \(V\sim\chi'^2_r(\gamma)\) then \(V\) has the law of \((Z_1+\sqrt\gamma)^2+\sum_{j=2}^rZ_j^2\) with \(Z_j\) independent \(\N(0,1)\): by Theorem 12.A.2.1 the first term has mgf \((1-2t)^{-1/2}e^{\gamma t/(1-2t)}\), the remaining sum has mgf \((1-2t)^{-(r-1)/2}\), and the product is the mgf of \(\chi'^2_r(\gamma)\). So (writing \(a=\sqrt\gamma\), \(r_1=k-1\), \(r_2=n-k\), and \(c=F_{1-\alpha,r_1,r_2}\)) \[ \text{power}(\gamma)=\P\Big(\frac{V/r_1}{U/r_2}\ge c\Big)=\P\big((Z_1+a)^2\ge X\big),\qquad X=\frac{r_1c}{r_2}U-\sum_{j=2}^{r_1}Z_j^2,\] with \(U\sim\chi^2_{r_2}\), where \(X\) is independent of \(Z_1\) and does not depend on \(\gamma\).
Monotone in \(\gamma\). For a fixed \(x>0\), put \(h(a,x)=\P((Z+a)^2\ge x)\); then \[ h(a,x)=1-\Phi(\sqrt x-a)+\Phi(-\sqrt x-a),\] and \[ \frac{\partial h}{\partial a}=\varphi(\sqrt x-a)-\varphi(\sqrt x+a)\ge0,\] because for \(a\ge0\), \(\sqrt x\ge0\) we have \(|\sqrt x-a|\le\sqrt x+a\) and \(\varphi\) decreases in \(|\cdot|\); the inequality is strict when \(a>0\). For \(x\le0\), \(h\equiv1\). Hence power \(=\E\,h(a,X)\) is increasing in \(a=\sqrt\gamma\), strictly so since \(\P(X>0)>0\).
Limits. At \(\gamma=0\) the power is \(\P(F\ge c)=\alpha\), so the test is unbiased: the power under any alternative exceeds the size. As \(a\to\infty\), \(h(a,x)\to1\) for every \(x\), and \(h\le1\), so by dominated convergence the power tends to 1. ∎
Computing it. A noncentral \(\chi^2\) variable with parameter \(\gamma\) is a central \(\chi^2_{r+2J}\) with \(J\sim\mathrm{Poisson}(\gamma/2)\) (compare the mgfs: \(e^{\gamma t/(1-2t)}=e^{-\gamma/2}\sum_j\frac{(\gamma/2)^j}{j!}(1-2t)^{-j}\)), so the power is the Poisson mixture \(\sum_{j\ge0}e^{-\gamma/2}\frac{(\gamma/2)^j}{j!}\,\P\big(\mathrm{Beta}(\frac{r_1}2+j,\frac{r_2}2)\ge\frac{r_1c}{r_1c+r_2}\big)\) (a ratio \(\chi^2_{r_1+2j}/(\chi^2_{r_1+2j}+\chi^2_{r_2})\) is a beta variable); the code evaluates this sum, and it is what the published tables of the power function tabulate.
Which alternative is easiest to detect. With \(n_j=r\) the noncentrality is \(\gamma=r\sum(\mu_j-\mu)^2/\sigma^2\): the power depends on the means only through the sum of their squared deviations from their average, not on where the means sit. Question 12.A.2.1 (\(k=5\), \(r=3\)): for \(H_1^*\colon(-1,2,0,1,-2)\) the sum of squares is 10 and for \(H_1^{**}\colon(-3,2,1,0,0)\) it is 14 (both average 0), so \(\gamma^*=30/\sigma^2<\gamma^{**}=42/\sigma^2\) and the \(F\) test has the greater power against \(H_1^{**}\): for \(\sigma=1\) the powers are 0.949 and 0.991, for \(\sigma=2\) they are 0.383 and 0.520. Question 12.A.2.2 asks whether \((2,1,1,-3,0)\), whose average is \(0.2\) rather than 0, is admissible: it is, because \(F\) (and \(\gamma\)) depend only on deviations from the average, so shifting every mean by a constant changes nothing; its sum of squared deviations is 14.8.
Planning. To detect a spread of true means \(\Delta=\max\mu_j-\min\mu_j\) the worst case is the least spread out configuration: the other means in the middle, with \(\sum(\mu_j-\mu)^2=\Delta^2/2\) (in general \(\sum(\mu_j-\mu)^2\ge(\mu_{\max}-\mu)^2+(\mu_{\min}-\mu)^2\ge\Delta^2/2\), because \(x^2+(\Delta-x)^2\ge\Delta^2/2\)). With \(k=4\), \(\sigma=9\), \(\Delta=9\), \(\alpha=0.05\) the smallest group size \(r\) with power at least 0.80 is
so to be safe against every configuration with that range one plans for the last row. Compare Filling the gap 7.17 (noncentral \(t\)) and 9.16 for the two-group version.true means \(\sum(\mu_j-\mu)^2/\sigma^2\) smallest \(r\) for power 0.80 \((0,0,9,9)\) (two clusters) 1.00 12 \((0,0,0,9)\) (one group high) 0.75 16 \((0,3,6,9)\) (evenly spread) 0.56 21 \((0,4.5,4.5,9)\) (the two extremes only) 0.50 23
See also (companion courses): the power of a test as a function of effect size and sample size, first-year power demo; Filling the gap 7.17 for the noncentral \(t\) law.
pp. 592–595 Case Study 12.2.1 ended with a rejection of \(H_0\colon\mu_1=\mu_2=\mu_3=\mu_4\) and a natural follow-up: which means differ? Nonsmokers and light smokers have nearly the same sample mean (62.3 against 63.2), heavy smokers a much larger one. It is tempting to answer by running an ordinary two-sample \(t\) test on every pair, but the combined error rate of those tests is not the \(\alpha\) used for each. If \(m\) tests were independent and each had probability 0.05 of a false rejection, the chance of at least one false rejection among ten would be \(1-0.95^{10}=0.40\), as the book computes; and the pairwise tests of \(k\) means are not independent, but their true error rate is still many times the nominal one (Filling the gap 12.12 gives it exactly). The remedy is a multiple comparison procedure: one that holds the probability of at least one false rejection at \(\alpha\), the familywise error rate, however many comparisons are made. The book develops the oldest and most used one, due to J. W. Tukey, for all \(\binom k2\) pairwise differences of means.
See also (companion courses): Bonferroni's method and the false discovery rate in Section 10.7 of the graduate course; the family-wise error rate in the statistical learning course with a demo.
Let \(W_1,\dots,W_k\) be independent \(\N(\mu,\sigma^2)\) with range \(R=\max_iW_i-\min_iW_i\), and let \(S^2\) be an estimator of \(\sigma^2\), independent of the \(W_i\), with \(\nu S^2/\sigma^2\sim\chi^2_\nu\). The Studentized range is \(Q_{k,\nu}=R/S\). Its upper point \(Q_{\alpha,k,\nu}\) satisfies \(\P(Q_{k,\nu}\ge Q_{\alpha,k,\nu})=\alpha\); the book tabulates it as Table A.5 for \(\alpha=0.05\) and \(0.01\).
For instance \(Q_{.05,4,8}=4.53\): the range of four normal variables exceeds \(4.53\) estimated standard deviations (with 8 degrees of freedom) only 5% of the time (Figure 12.3.1). In the book's application \(W_t=\bar Y_{\cdot t}-\mu_t\) and \(S^2=\mathrm{MSE}/r\), with \(\nu=n-k=k(r-1)\) degrees of freedom. The law does not depend on \(\mu\) or \(\sigma\), which is what makes the procedure usable.
The book defines \(Q_{k,\nu}\) and tabulates it without saying where the numbers come from. Both the range law and the Studentized law are one-dimensional integrals. (Table A.5 and Figure 12.3.1 are computed from them.)
The range of \(k\) variables is at most \(r\) exactly when the smallest one has all the others within \(r\) above it. Condition on the value of the smallest and sum over which index it is.
Find \(\P(A_i)\) where \(A_i=\{W_i\text{ smallest, others in }(W_i,W_i+r]\}\). Aim for: \(\int\varphi(x)[\Phi(x+r)-\Phi(x)]^{k-1}\d x\).
Add over \(i\) and standardise to remove \(\mu\) and \(\sigma\). Aim for: \(\P(R\le r)=k\int\varphi(x)[\Phi(x+r)-\Phi(x)]^{k-1}\d x\).
Condition on \(S\) to Studentize, then test the case \(k=2\). Aim for: \(Q_{2,\nu}=\sqrt2\,|T_\nu|\), so \(Q_{\alpha,2,\nu}=\sqrt2\,t_{\alpha/2,\nu}\).
The range of standard normals. Let \(W_1,\dots,W_k\) be independent \(\N(0,1)\), with density \(\varphi\) and cdf \(\Phi\). With probability one there are no ties, and \(R\le r\) holds exactly when, for the index \(i\) of the smallest variable, all others lie in \((W_i,W_i+r]\). The events \(A_i=\{W_i\text{ is the smallest and every other }W_j\in(W_i,W_i+r]\}\) are disjoint and \(\{R\le r\}=\bigcup_iA_i\). Conditional on \(W_i=x\), the other \(k-1\) variables are independent, each in \((x,x+r]\) with probability \(\Phi(x+r)-\Phi(x)\), so \(\P(A_i)=\int\varphi(x)[\Phi(x+r)-\Phi(x)]^{k-1}\d x\) and \[ \P(R\le r)=k\int_{-\infty}^\infty\varphi(x)\big[\Phi(x+r)-\Phi(x)\big]^{k-1}\d x.\] For \(W_i\sim\N(\mu,\sigma^2)\) apply this to \((W_i-\mu)/\sigma\): the range is \(\sigma\) times the range of standard normals, so \(R/\sigma\) has this law whatever \(\mu\) and \(\sigma\) are.
Studentizing. If \(S^2=\sigma^2V/\nu\) with \(V\sim\chi^2_\nu\) is independent of the \(W_i\), then conditioning on \(V=v\), \[ \P(Q_{k,\nu}\le q)=\P\Big(\frac R\sigma\le q\frac S\sigma\Big)=\int_0^\infty\P\Big(R_1\le q\sqrt{v/\nu}\Big)f_{\chi^2_\nu}(v)\d v,\] with \(R_1\) the range of \(k\) standard normals; \(\sigma\) has cancelled, so the law of \(Q_{k,\nu}\) depends only on \(k\) and \(\nu\). Inserting the first display gives a double integral that is evaluated numerically; the code does this and recovers \(Q_{.05,4,8}=4.529\) and \(Q_{.05,5,15}=4.367\), the book's 4.53 and 4.37. ∎
Two checks. For \(k=2\) the range is \(|W_1-W_2|\sim\sigma\sqrt2|Z|\), so \(Q_{2,\nu}=\sqrt2\,|Z|/\sqrt{V/\nu}=\sqrt2\,|T_\nu|\) and \(Q_{\alpha,2,\nu}=\sqrt2\,t_{\alpha/2,\nu}\): Tukey's method for two means is the ordinary two-sided \(t\) interval. For fixed \(\nu\), \(Q_{\alpha,k,\nu}\) increases with \(k\) (a larger range is more likely among more variables), and for fixed \(k\) it decreases with \(\nu\) towards the \(\nu=\infty\) value, the point of the range of \(k\) standard normals itself.
fig_12_3_1.In a one-factor design with the same sample size \(r\) at each of the \(k\) levels, put \(D=Q_{\alpha,k,rk-k}/\sqrt r\). With probability \(1-\alpha\) the \(\binom k2\) inequalities \[ \bar Y_{\cdot i}-\bar Y_{\cdot j}-D\sqrt{\mathrm{MSE}}<\mu_i-\mu_j<\bar Y_{\cdot i}-\bar Y_{\cdot j}+D\sqrt{\mathrm{MSE}}\] hold simultaneously for all \(i\ne j\). If an interval does not contain 0, \(H_0\colon\mu_i=\mu_j\) is rejected for that pair.
The book's proof is two lines: the range of the \(\bar Y_{\cdot t}-\mu_t\) is bounded, and that is the same as all pairwise differences being bounded. Three points need spelling out: why the Studentized range law applies (the independence of \(\mathrm{MSE}\)), why the coverage is exactly \(1-\alpha\), and what "rejecting at level \(\alpha\)" then means for a family of tests.
Show that \(\max_tW_t-\min_tW_t\) over \(\sqrt{\mathrm{MSE}/r}\) is exactly a Studentized range, then note that the range is the largest pairwise difference. What does that say about all the pairs at once?
Check the hypotheses of the definition for \(W_t=\bar Y_{\cdot t}-\mu_t\) and \(S^2=\mathrm{MSE}/r\). Aim for: a pivot with law \(Q_{k,rk-k}\), free of all parameters.
Turn "range \(<D\sqrt{\mathrm{MSE}}\)" into the statement for every pair and then into the \(\binom k2\) intervals. Aim for: coverage exactly \(1-\alpha\).
For a family in which only some pairs are truly equal, argue that false rejections require the full system to fail. Aim for: familywise error at most \(\alpha\); then comment on unequal sizes.
The pivot. Put \(W_t=\bar Y_{\cdot t}-\mu_t\). The \(W_t\) are independent \(\N(0,\sigma^2/r)\). Also \(\mathrm{MSE}\) satisfies \(\nu\,\mathrm{MSE}/\sigma^2\sim\chi^2_\nu\) with \(\nu=n-k=rk-k\) and is independent of all the \(\bar Y_{\cdot j}\) (Filling the gap 12.2), hence of the \(W_t\). Apply Definition 12.3.1 with \(S^2=\mathrm{MSE}/r\), an estimator of \(\sigma^2/r\): the ratio \(\dfrac{\max W_t-\min W_t}{\sqrt{\mathrm{MSE}/r}}\) is \(Q_{k,\nu}\), so \[ \P\Big(\max_tW_t-\min_tW_t<\frac{Q_{\alpha,k,\nu}}{\sqrt r}\sqrt{\mathrm{MSE}}\Big)=1-\alpha.\] The equivalence. \(\max_tW_t-\min_tW_t=\max_{i,j}|W_i-W_j|\), the largest of the pairwise differences. So the event above says exactly that \(|W_i-W_j|<D\sqrt{\mathrm{MSE}}\) for every pair, and since \(W_i-W_j=(\bar Y_{\cdot i}-\bar Y_{\cdot j})-(\mu_i-\mu_j)\) this is the system of intervals of the theorem. Its probability is exactly \(1-\alpha\) for all values of the \(\mu_j\) and \(\sigma\): no approximation and no Bonferroni-type slack.
As a family of tests. Suppose some of the means are equal and others are not. The tests of the true pairs \(H_{ij}\colon\mu_i=\mu_j\) (those with \(\mu_i-\mu_j=0\)) make an error only if the interval for that pair misses its true difference 0; that is implied by the failure of the full system, which has probability \(\alpha\). So the probability of at least one false rejection is at most \(\alpha\) whichever means are equal (strong control), and exactly \(\alpha\) when all are equal. This is the meaning of the book's phrase "reject at the \(\alpha\) level": \(\alpha\) is the familywise level, not the level of each single comparison.
Unequal sample sizes. When the \(n_j\) differ, the natural interval (Tukey and Kramer) uses \(\frac{Q_{\alpha,k,n-k}}{\sqrt2}\sqrt{\mathrm{MSE}\,(\frac1{n_i}+\frac1{n_j})}\) for \(\mu_i-\mu_j\). It reduces to the book's half-width \(D\sqrt{\mathrm{MSE}}\) when all \(n_j=r\), but the argument above no longer gives an exact pivot, because \(\bar Y_{\cdot i}-\bar Y_{\cdot j}\) now have different variances; the simultaneous coverage is at least \(1-\alpha\) (Hayter 1984), so the procedure is conservative. ∎
Tukey versus the \(F\) test. For \(k=2\) the two agree, since \(Q_{\alpha,2,\nu}^2/2=t_{\alpha/2,\nu}^2=F_{1-\alpha,1,\nu}\). For \(k\ge3\) they need not: the \(F\) test responds to the total squared spread of the means, Tukey's to the largest gap. At the 5% level the price-earnings data of Question 12.2.3 give \(F=3.45\) (\(P=0.046\)), a rejection, but no Tukey interval excludes 0; conversely one extreme mean can be detected by Tukey and diluted in the \(F\) ratio. So one does not use the \(F\) test as a gatekeeper for Tukey's method (which has its own exact level) but treats them as answers to two different questions.
Table 12.3.1 of the book gives the percentage of each of five antibiotics bound to bovine serum protein, four determinations each (\(k=5\), \(r=4\), \(n=20\)):
| Penicillin G (1) | Tetracycline (2) | Streptomycin (3) | Erythromycin (4) | Chloramphenicol (5) |
|---|---|---|---|---|
| 29.6 | 27.3 | 5.8 | 21.6 | 29.2 |
| 24.3 | 32.6 | 6.2 | 17.4 | 32.8 |
| 28.5 | 30.8 | 11.0 | 18.3 | 25.0 |
| 32.0 | 34.8 | 8.3 | 19.0 | 24.2 |
| 28.60 | 31.38 | 7.83 | 19.08 | 27.80 |
(Last row: sample means.) The ANOVA has \(\mathrm{SSTR}=1480.82\) on 4 df, \(\mathrm{SSE}=135.82\) on 15 df, \(\mathrm{MSE}=9.055\), \(F=40.9\) (\(P<10^{-6}\)): the means are certainly not all equal. For Tukey's intervals at \(\alpha=0.05\): \(Q_{.05,5,15}=4.367\), \(D=4.367/\sqrt4=2.183\) and \(D\sqrt{\mathrm{MSE}}=2.183\times3.009=6.57\) (the book's 6.58 rounds \(\mathrm{MSE}\) to 9.06 first). All ten pairs:
| Pair | \(\bar y_{\cdot i}-\bar y_{\cdot j}\) | Tukey interval | Conclusion |
|---|---|---|---|
| \(\mu_1-\mu_2\) | −2.78 | (−9.35, 3.80) | not rejected |
| \(\mu_1-\mu_3\) | 20.78 | (14.20, 27.35) | reject |
| \(\mu_1-\mu_4\) | 9.53 | (2.95, 16.10) | reject |
| \(\mu_1-\mu_5\) | 0.80 | (−5.77, 7.37) | not rejected |
| \(\mu_2-\mu_3\) | 23.55 | (16.98, 30.12) | reject |
| \(\mu_2-\mu_4\) | 12.30 | (5.73, 18.87) | reject |
| \(\mu_2-\mu_5\) | 3.58 | (−3.00, 10.15) | not rejected |
| \(\mu_3-\mu_4\) | −11.25 | (−17.82, −4.68) | reject |
| \(\mu_3-\mu_5\) | −19.98 | (−26.55, −13.40) | reject |
| \(\mu_4-\mu_5\) | −8.73 | (−15.30, −2.15) | reject |
Seven pairs are separated and three are not (Penicillin G, Tetracycline and Chloramphenicol bind alike; Streptomycin and Erythromycin each bind differently from every other). The usual picture marks the means on one axis and draws a line under each set of means that are not separated (Figure 12.3.2). The book's intervals differ in the second decimal (it computes from means rounded to one decimal); no conclusion changes.
fig_12_3_2.The book's "\(1-0.95^{10}=0.40\)" is exact for ten independent tests. The pairwise tests of \(k\) means are not independent (each mean enters \(k-1\) differences and all use one \(\mathrm{MSE}\)), but the probability of a false alarm can be computed exactly, because the largest pairwise difference is the range.
When all means are equal, the largest pairwise \(t\) statistic is the range of the means, so "at least one pairwise test rejects" is a statement about a Studentized range. Which cut-off does each method use?
Show that some pair rejects exactly when \(R/\sqrt{\mathrm{MSE}/r}>\sqrt2\,t_{\alpha/2,\nu}\). Aim for: the error rate \(=\P(Q_{k,\nu}>\sqrt2\,t_{\alpha/2,\nu})\).
Do the same for the Bonferroni cut-off \(t_{\alpha/(2m),\nu}\) and bound it with Boole's inequality. Aim for: a rate at most \(\alpha\).
Explain why \(1-0.95^m\) is not the exact answer (are the pairwise statistics independent?) and read the table of numbers. Aim for: for \(k=5\), \(r=10\) the ordering \(1-0.95^{10}=0.401>0.276\) (all pairwise tests) \(>0.050\) (Tukey) \(>0.038\) (Bonferroni).
Let all \(k\) means be equal, with \(r\) observations each, \(\nu=k(r-1)\), \(m=\binom k2\). The pairwise \(t\) test of \(\mu_i=\mu_j\) rejects when \(|\bar Y_{\cdot i}-\bar Y_{\cdot j}|>t_{\alpha/2,\nu}\sqrt{2\,\mathrm{MSE}/r}\) (the \(t\) test with the pooled \(\mathrm{MSE}\), \(\nu\) degrees of freedom). At least one pair rejects exactly when the largest difference does, that is, when the range of the group means exceeds this bound; dividing by \(\sqrt{\mathrm{MSE}/r}\), \[ \P(\text{at least one false rejection})=\P\big(Q_{k,\nu}>\sqrt2\,t_{\alpha/2,\nu}\big),\] a tail probability of the Studentized range (Filling the gap 12.10). With the same device, Bonferroni's method (each test at level \(\alpha/m\); by Boole's inequality the chance of any false rejection is at most \(m\cdot\alpha/m=\alpha\)) has true rate \(\P(Q_{k,\nu}>\sqrt2\,t_{\alpha/(2m),\nu})\le\alpha\), and Tukey's method uses the cut-off \(Q_{\alpha,k,\nu}\) and has rate exactly \(\alpha\) (Theorem 12.3.1). ∎
Numbers (\(\alpha=0.05\), \(r=10\) observations per mean):
The independence formula overstates the true rate (the tests are positively dependent: one large \(\bar Y_{\cdot i}\) makes several differences large together), but the rate for ten means is still twelve times the nominal 5%. Bonferroni protects the level but wastes some of it (its true rate falls as \(m\) grows), so its intervals are a little wider than Tukey's, which uses all of \(\alpha\) (Figure x12.2). Bonferroni's advantage is generality: it needs only Boole's inequality and works for any set of \(m\) tests, such as a few planned contrasts.means \(k\) pairs \(m\) \(1-0.95^m\) all pairwise \(t\) tests Bonferroni Tukey 3 3 0.143 0.119 0.043 0.050 5 10 0.401 0.276 0.038 0.050 10 45 0.901 0.610 0.035 0.050
fig_x12_2.The book next notes that a Tukey interval is "a test of \(H_0\colon\mu_i=\mu_j\)": a zero inside the interval means the pair is not separated. Question 12.3.6 asks whether \(\mu_1\ne\mu_2\) and \(\mu_1\ne\mu_3\) force \(\mu_2\ne\mu_3\) (it does not; see the solution) and Question 12.3.7 why the intervals lengthen as \(k\) grows (\(Q_{\alpha,k,\nu}\) increases with \(k\), as the range of more normals is larger, and no compensating gain in \(\mathrm{MSE}\) occurs).
pp. 596–603 There are two situations in which one tests a subhypothesis. If the experimenter looks at the results first and the data suggest the comparison, a multiple comparison method such as Tukey's (Section 12.3) is needed. If a particular comparison was fixed before the data were seen, because of physics, economics or earlier work, it can be tested with a contrast, and the test has more power than the corresponding post hoc one (Filling the gap 12.15).
A linear combination \(C=\sum_{j=1}^kc_j\mu_j\) of the true means is a contrast if \(\sum_jc_j=0\).
The pairwise hypothesis \(H_0\colon\mu_1=\mu_2\) is the contrast \(C=\mu_1-\mu_2\) (coefficients \(1,-1,0,\dots\)). In Case Study 12.3.1, comparing the average binding of the first two antibiotics with that of the last three is \(H_0\colon\frac{\mu_1+\mu_2}2=\frac{\mu_3+\mu_4+\mu_5}3\), the contrast \(C=\frac12\mu_1+\frac12\mu_2-\frac13\mu_3-\frac13\mu_4-\frac13\mu_5\). Each is zero if \(H_0\) holds, so estimate \(C\) and ask whether the estimate is too far from 0.
The estimator is \(\hat C=\sum_jc_j\bar Y_{\cdot j}\), unbiased, with variance \(\V\hat C=\sigma^2\sum_jc_j^2/n_j\) (independent samples). Replacing \(\sigma^2\) by \(\mathrm{MSE}\) gives the estimated variance \(S_{\hat C}^2=\mathrm{MSE}\sum_jc_j^2/n_j\). Because the \(\bar Y_{\cdot j}\) are independent normal, \(\hat C\) is normal and \((\hat C-C)^2/\V\hat C\sim\chi^2_1\). Two contrasts \(\sum_jc_{1j}\mu_j\) and \(\sum_jc_{2j}\mu_j\) are orthogonal if \(\sum_jc_{1j}c_{2j}/n_j=0\); a set of contrasts is mutually orthogonal if every pair is.
For a contrast \(C_i=\sum_jc_{ij}\mu_j\) with estimator \(\hat C_i=\sum_jc_{ij}\bar Y_{\cdot j}\), \(\mathrm{SSC}_i=\dfrac{\hat C_i^2}{\sum_jc_{ij}^2/n_j}\).
12.4.1. If \(C_1,\dots,C_{k-1}\) are mutually orthogonal contrasts, then \(\mathrm{SSTR}=\mathrm{SSC}_1+\dots+\mathrm{SSC}_{k-1}\).
12.4.2. For the contrast \(C=\sum c_j\mu_j\) (\(\sum c_j=0\)), \(F=\dfrac{\mathrm{SSC}/1}{\mathrm{SSE}/(n-k)}\sim F_{1,n-k}\) when \(H_0\colon C=0\) is true, and \(H_0\) is rejected at level \(\alpha\) if \(F\ge F_{1-\alpha,1,n-k}\).
The book states both without proof. The next two boxes prove them. (The book's comment is right that only planned contrasts need be tested, and that orthogonality is a convenience, not a requirement.)
The theorem needs three facts: \(\hat C\) is normal with a known variance, it is independent of \(\mathrm{MSE}\), and \(\mathrm{MSE}\) has \(n-k\) degrees of freedom (all \(k\) groups contribute, not only those with a nonzero coefficient).
\(\hat C\) is a linear combination of independent normal means, \(\mathrm{MSE}\) is independent of it, and both are known up to \(\sigma^2\). Which ratio of the two gives a \(t\) law, and what is its square?
Find the law of \(\hat C\). Aim for: \(\N(C,\sigma^2\sum c_j^2/n_j)\).
Form \(T=\hat C/\sqrt{\mathrm{MSE}\sum c_j^2/n_j}\) when \(C=0\). Aim for: \(T\sim t_{n-k}\) and \(T^2=\mathrm{SSC}/\mathrm{MSE}\).
State the \(F\) test, the interval for \(C\) and (for \(C\ne0\)) the noncentrality. What does \(c=(1,-1,0,\dots)\) give, and how does it differ from the two-sample test?
\(\hat C=\sum c_j\bar Y_{\cdot j}\) is a linear combination of independent normal variables (Theorem 4.3.3), so \(\hat C\sim\N\big(C,\ \sigma^2\sum c_j^2/n_j\big)\); no condition on \(\sum c_j\) is needed for this. \(\mathrm{MSE}\) is a function of the \(S_j^2\) and \(\hat C\) a function of the \(\bar Y_{\cdot j}\), so they are independent (Filling the gap 12.2), and \((n-k)\mathrm{MSE}/\sigma^2\sim\chi^2_{n-k}\).
Put \(w=\sum c_j^2/n_j\). If \(H_0\colon C=0\) holds, \(Z=\hat C/(\sigma\sqrt w)\sim\N(0,1)\) and \[ T=\frac{\hat C}{\sqrt{\mathrm{MSE}\,w}}=\frac{Z}{\sqrt{[(n-k)\mathrm{MSE}/\sigma^2]/(n-k)}}\sim t_{n-k},\] the ratio of a standard normal and the root of an independent \(\chi^2_{n-k}/(n-k)\) (Definition 7.3.3). Then \(T^2=\dfrac{\hat C^2/w}{\mathrm{MSE}}=\dfrac{\mathrm{SSC}}{\mathrm{MSE}}=F\sim F_{1,n-k}\), because the square of a \(t_\nu\) variable is \(F_{1,\nu}\). That is Theorem 12.4.2. Only \(C=0\) is needed: it is not necessary that all the means be equal (the book's remark "if \(H_0\colon\mu_1=\dots=\mu_k\) is true, \(C\) is 0" gives one case). ∎
Consequences. (a) A \(1-\alpha\) confidence interval for \(C\) is \(\hat C\pm t_{\alpha/2,n-k}\sqrt{\mathrm{MSE}\sum c_j^2/n_j}\). (b) Under an alternative \(C\ne0\) the \(F\) ratio is noncentral \(F'_{1,n-k}(\gamma)\) with \(\gamma=C^2/(\sigma^2w)\) (the same argument as in Filling the gap 12.8 with one degree of freedom), so its power rises with \(|C|\) and falls with the standard error. (c) For \(c=(1,-1,0,\dots,0)\) the statistic is \(F=(\bar Y_{\cdot1}-\bar Y_{\cdot2})^2/[\mathrm{MSE}(1/n_1+1/n_2)]=T^2\): the two-sample pooled \(t\) test of Theorem 9.2.2 but with the variance estimated from all \(k\) groups, \(n-k\) degrees of freedom instead of \(n_1+n_2-2\). It is more powerful if the variances are equal, and misleading if the other groups have a different variance. (d) The test is the likelihood ratio test of the subhypothesis \(C=0\) and is invariant to adding a constant to every observation (because \(\sum c_j=0\)); this is why the coefficients must sum to 0.
The statement is geometry in disguise: the vector of weighted deviations of the group means lives in a \((k-1)\)-dimensional space, a contrast is a direction in it, \(\mathrm{SSC}\) is the squared length of the projection onto that direction, and orthogonal contrasts are orthogonal directions. Parseval's identity does the rest.
Turn the weighted deviations of the group means into a vector \(\bm u\), and each contrast into a vector \(\bm a\). Show that \(\mathrm{SSC}\) is the squared projection of \(\bm u\) on \(\bm a\); then orthogonal contrasts are orthogonal directions and Parseval applies.
Define \(u_j=\sqrt{n_j}(\bar Y_{\cdot j}-\bar Y_{\cdot\cdot})\), \(s_j=\sqrt{n_j}\), \(a_j=c_j/\sqrt{n_j}\). Aim for: \(\bm s\cdot\bm u=0\), \(\bm s\cdot\bm a=0\), \(\bm a\cdot\bm u=\hat C\).
Express \(\mathrm{SSC}\) and the orthogonality condition in these vectors. Aim for: \(\mathrm{SSC}=(\bm a\cdot\bm u)^2/\|\bm a\|^2\) and \(\bm a_s\cdot\bm a_t=\sum c_{sj}c_{tj}/n_j\).
Count dimensions and apply Parseval. Aim for: \(\mathrm{SSTR}=\|\bm u\|^2=\sum_i\mathrm{SSC}_i\). Which contrast gives \(\mathrm{SSC}=\mathrm{SSTR}\)?
Define vectors in \(\R^k\): \(\bm s=(\sqrt{n_1},\dots,\sqrt{n_k})\), \(\bm u\) with \(u_j=\sqrt{n_j}(\bar Y_{\cdot j}-\bar Y_{\cdot\cdot})\), and for a contrast with coefficients \(c_j\) the vector \(\bm a\) with \(a_j=c_j/\sqrt{n_j}\). Then:
Now take \(k-1\) mutually orthogonal contrasts. Their vectors \(\bm a_1,\dots,\bm a_{k-1}\) are nonzero, mutually orthogonal (hence independent) vectors in the \((k-1)\)-dimensional space \(\bm s^\perp\), so they form an orthogonal basis of it. For an orthogonal basis, \(\|\bm u\|^2=\sum_i(\bm a_i\cdot\bm u)^2/\|\bm a_i\|^2\) (Parseval), that is \(\mathrm{SSTR}=\sum_i\mathrm{SSC}_i\). ∎
Further consequences. (a) At most \(k-1\) nonzero contrasts can be mutually orthogonal, and any smaller orthogonal set gives \(\sum\mathrm{SSC}_i\le\mathrm{SSTR}\) (Bessel's inequality). (b) For every contrast \(\mathrm{SSC}\le\mathrm{SSTR}\), with equality for the contrast \(c_j\propto n_j(\bar Y_{\cdot j}-\bar Y_{\cdot\cdot})\) (take \(\bm a\propto\bm u\)): \(\mathrm{SSTR}\) is the sum of squares of the best contrast chosen after seeing the data. This is used in Filling the gap 12.15. (c) Building orthogonal contrasts: orthonormalise \(\bm s/\|\bm s\|,\bm e_1,\dots,\bm e_{k-1}\) by Gram–Schmidt, drop the first vector, and put \(c_{ij}=\sqrt{n_j}\,a_{ij}\) (the code does this: helmert_contrasts). For equal sizes this gives, up to scale, \((3,-1,-1,-1),(0,2,-1,-1),(0,0,1,-1)\) (each level against the average of the later ones); starting from \(\bm e_k,\dots,\bm e_2\) instead gives the familiar Helmert set \((1,-1,0,0),(1,1,-2,0),(1,1,1,-3)\). (d) The \(\mathrm{SSC}_i\) of orthogonal contrasts are independent (the \(\hat C_i\) are jointly normal with zero covariances), though they share \(\mathrm{MSE}\).
Check against the book. In Case Study 12.4.1 \(C_1=\mu_A-\mu_B\) and \(C_2=\mu_C-\mu_D\) use disjoint groups, so they are orthogonal; Question 12.4.5's third contrast \(C_3=\frac{11}{12}\mu_A+\frac{11}{12}\mu_B-\mu_C-\frac56\mu_D\) is orthogonal to both: with \(n=(6,6,6,5)\), \(\sum c_{3j}c_{1j}/n_j=\frac{11/12}6-\frac{11/12}6=0\) and \(\sum c_{3j}c_{2j}/n_j=-\frac16+\frac{5/6}{5}=0\). The three sums of squares are 4.688, 1.123 and 8.967, adding to 14.778 \(=\mathrm{SSTR}\).
Twenty-three one-week-old boys were randomly divided into four groups and for seven weeks followed different programmes: A, daily walking and placing exercises; B, daily exercise periods without the special exercises; C and D, nothing special (group D was examined only once, at the end). Table 12.4.1 of the book lists the age (months) at which each child first walked alone:
| Group A | Group B | Group C | Group D |
|---|---|---|---|
| 9.00 | 11.00 | 11.50 | 13.25 |
| 9.50 | 10.00 | 12.00 | 11.50 |
| 9.75 | 10.00 | 9.00 | 12.00 |
| 10.00 | 11.75 | 11.50 | 13.50 |
| 13.00 | 10.50 | 13.25 | 11.50 |
| 9.50 | 15.00 | 13.00 | |
| 10.125 | 11.375 | 11.708 | 12.350 |
(Last row: means; \(T_{\cdot j}=60.75,\ 68.25,\ 70.25,\ 61.75\).) The ANOVA has \(\mathrm{SSTR}=14.78\) (3 df), \(\mathrm{SSE}=43.69\) (19 df), \(\mathrm{MSE}=2.30\), \(F=2.14\) (\(P=0.129\)), below \(F_{.95,3,19}=3.13\): the four means cannot be told apart. The book proceeds anyway, to illustrate contrasts. Groups A and B spent the same time exercising but followed different regimes, so \(C_1=\mu_A-\mu_B\) assesses the special exercises; \(C_2=\mu_C-\mu_D\) assesses the effect of weekly progress checks. With \(n=(6,6,6,5)\):
| Subhypothesis | contrast | \(\hat C\) | SSC | \(F\) | \(P\) |
|---|---|---|---|---|---|
| \(H_0\colon\mu_A=\mu_B\) | \(\mu_A-\mu_B\) | −1.25 | 4.69 | 2.04 | 0.170 |
| \(H_0\colon\mu_C=\mu_D\) | \(\mu_C-\mu_D\) | −0.64 | 1.12 | 0.49 | 0.493 |
Neither exceeds \(F_{.95,1,19}=4.38\) (the book's 4.68 and 2.03 come from rounded means). The special exercises moved the walking age by 1.25 months, in the right direction, but with \(n=6\) per group and a standard deviation of 1.5 months the study cannot separate that from chance: lack of significance is not evidence of no effect (Chapter 6).
The book asserts that tests based on contrasts "have greater power" than multiple comparison procedures. For a single comparison the three procedures use the same statistic and differ only in the cut-off; the cut-off is larger the more comparisons the method must protect against.
For one pairwise difference the three procedures use the same statistic \(F=T^2\); only the cut-off differs, and each cut-off must protect a bigger family of comparisons than the one before. Which families are nested, and what does that say about the cut-offs?
Write the three rejection rules on the scale of \(F\). Aim for: cut-offs \(F_{1-\alpha,1,\nu}\), \(Q^2/2\) and \((k-1)F_{1-\alpha,k-1,\nu}\).
Prove the Scheffé rule from \(\mathrm{SSC}\le\mathrm{SSTR}\). Aim for: "some contrast rejects" implies "the \(F\) test rejects", which has probability \(\alpha\) under \(H_0\).
Compare the powers for a true difference \(\Delta\): the pair statistic has noncentrality \(r\Delta^2/(2\sigma^2)\). Aim for: the planned contrast is the most powerful of the three, and say what price that carries.
For a pairwise difference, the statistic of Theorem 12.4.2 is \(F=T^2\) with \(T=(\bar Y_{\cdot i}-\bar Y_{\cdot j})/\sqrt{\mathrm{MSE}(1/n_i+1/n_j)}\). Written on the scale of \(F\):
The third rule is valid because \(\mathrm{SSC}\le\mathrm{SSTR}\) for every contrast (Filling the gap 12.14, consequence (b)): the event that some contrast has \(\mathrm{SSC}/\mathrm{MSE}\ge(k-1)F_{1-\alpha,k-1,\nu}\) is contained in the event \(\mathrm{SSTR}/\mathrm{MSE}\ge(k-1)F_{1-\alpha,k-1,\nu}\), that is \(F\ge F_{1-\alpha,k-1,\nu}\), which has probability \(\alpha\) under \(H_0\). So with probability \(1-\alpha\) no contrast is declared significant when all means are equal; for contrasts of nonzero true value the same argument applied to the centred means gives simultaneous intervals. Each rule is valid for its family, and the families are nested (one comparison, all pairs, all contrasts), so the cut-offs increase. ∎
Numbers. Five means, ten observations each (\(\nu=45\)), \(\alpha=0.05\): cut-offs for the \(F\) of a pairwise difference are 4.06 (planned), 8.07 (Tukey) and 10.31 (Scheffé). Power for a true difference \(\Delta\) between the two means (noncentral \(F'_{1,45}(\gamma)\) with \(\gamma=r\Delta^2/(2\sigma^2)\)):
The price of a planned contrast is discipline. It must be specified before the data are seen, and testing a few of them separately at level \(\alpha\) lets the overall error rate grow (Bonferroni: at most \(m\alpha\) for \(m\) contrasts; Filling the gap 12.12). Picking the contrast that the data suggest (the largest gap, the biggest group against the rest) and then using the planned cut-off is the mistake that multiple comparison methods exist to prevent.\(\Delta/\sigma\) planned Tukey Scheffé 1.0 0.59 0.29 0.18 1.5 0.91 0.69 0.56 2.0 0.99 0.94 0.89
p. 600 Journals rarely print the individual \(Y_{ij}\); they print means, standard deviations and sample sizes. That is enough to redo the whole analysis: \(\mathrm{SSTR}=\sum n_j(\bar Y_{\cdot j}-\bar Y_{\cdot\cdot})^2\) needs only \((n_j,\bar Y_{\cdot j})\), and \(\mathrm{SSE}=\sum(n_j-1)S_j^2\) needs only \((n_j,S_j)\). Case Study 12.4.2 does it.
After 25 dinner parties each, a server added to the bill (1) "United We Stand" with a flag, (2) "God Bless America" with a flag, (3) "Have a Nice Day" with a smiley face, or (4) nothing. Table 12.4.4 of the book gives the mean tip (percentage of the bill) and standard deviation for each: \(\bar y=19.90,\ 17.85,\ 15.93,\ 15.52\), \(s=4.86,\ 3.98,\ 2.86,\ 3.04\). The grand mean is 17.30, so \[ \mathrm{SSTR}=25\sum(\bar y_{\cdot j}-17.30)^2=302.70\ (3\text{ df}),\qquad\mathrm{SSE}=24\,(4.86^2+3.98^2+2.86^2+3.04^2)=1365.15\ (96\text{ df}).\]
| Source | df | SS | MS | \(F\) | \(P\) |
|---|---|---|---|---|---|
| Messages | 3 | 302.70 | 100.90 | 7.10 | 0.0002 |
| Error | 96 | 1365.15 | 14.22 | ||
| Total | 99 | 1667.84 |
\(H_0\colon\mu_1=\mu_2=\mu_3=\mu_4\) is rejected (\(F_{.95,3,96}=2.70\)). Tukey's method (\(Q_{.05,4,96}=3.70\), \(D\sqrt{\mathrm{MSE}}=\frac{3.70}{5}\times3.771=2.79\)) separates two of the six pairs: message 1 from message 3 (difference 3.97, interval \((1.18,\,6.76)\)) and from no message (4.38, \((1.59,\,7.17)\)); the others, for instance 1 against 2 (\(2.05\), \((-0.74,\,4.84)\)), are not separated.
A planned contrast. Before the data one could ask a different question: does any message help, whatever it says, or does the content matter? The contrast \(C=\frac13\mu_1+\frac13\mu_2+\frac13\mu_3-\mu_4\) compares "some message" with "no message". Its estimate is \[ \hat C=\tfrac13(19.90+17.85+15.93)-15.52=2.373,\] and \[ \mathrm{SSC}=\frac{2.373^2}{3\,(1/3)^2/25+1/25}=\frac{5.633}{0.05333}=105.61,\qquad F=\frac{105.61}{1365.15/96}=7.43\] on 1 and 96 df, \(P=0.0076\), above \(F_{.95,1,96}=3.94\): \(H_0\colon C=0\) is rejected. Taken together: writing nothing is the one clearly bad choice, and the patriotic note did best (by Tukey), though the data were collected shortly after the events of 11 September 2001, so the ranking may not carry over. A caution about the planned contrast: its cut-off of 3.94 is the planned one. If the comparison "some message against none" had been chosen after looking at the table, the Scheffé cut-off \(3\times2.70=8.10\) would apply and 7.43 would not be significant (Filling the gap 12.15).
The book reconstructs the table without saying why it is legitimate, and the printed arithmetic of Case Study 12.4.2 has several small slips. Both points are short.
Which functions of the data do \(\mathrm{SSTR}\), \(\mathrm{SSE}\), Tukey's half-width and a contrast use? If it is only the group sizes, means and standard deviations, those summaries are enough, and the rest of the question is arithmetic.
Write the likelihood in terms of \((\bar Y_{\cdot j},S_j^2)\). Aim for: a function of the data only through these summaries.
Recompute the printed numbers of Case Study 12.4.2 from means, standard deviations and sizes. Aim for: \(\mathrm{SSTR}=302.695\), \(\mathrm{SSE}=1365.15\), \(F=7.095\).
List what is lost (residual checks). Find the slips of the printed solution: the total \(T_{\cdot4}\), the standard deviation 3.04, the rounding of \(\hat C\), the interpolated \(Q\).
Under the model of Section 12.2 the likelihood depends on the data only through \((\bar Y_{\cdot j},S_j^2)\), \(j=1,\dots,k\) (since \[ \sum_i(Y_{ij}-\mu_j)^2=(n_j-1)S_j^2+n_j(\bar Y_{\cdot j}-\mu_j)^2,\] the normal likelihood is \(\prod_j(2\pi\sigma^2)^{-n_j/2}\exp\{-[\dots]/(2\sigma^2)\}\) with \([\dots]\) that sum), so these are sufficient statistics. Every procedure of this chapter is a function of them: \(\mathrm{SSTR}\), \(\mathrm{SSE}\), \(F\), the Tukey half-width (\(\mathrm{MSE}\) and the \(n_j\)), a contrast and its \(F\) (the \(\bar Y_{\cdot j}\) and \(\mathrm{MSE}\)). The total sum of squares needs no separate calculation: \(\mathrm{SSTOT}=\mathrm{SSTR}+\mathrm{SSE}\). Nothing is lost for inference if the model holds. What is lost is the ability to check the model: residual plots, outliers, skewness and a within-group pattern of variance are invisible in summaries. (Compare sufficiency in Chapter 5.) ∎
Slips in the printed solution of Case Study 12.4.2 (none changes a conclusion): the total is written \(497.50+446.25+398.25+388.60\) where the last term should be \(388.00=25\times15.52\) (\(C=29{,}929=1730^2/100\) uses the right value); \(\mathrm{SSE}\) is displayed with \((3.01)^2\) where the standard deviation of group 4 is 3.04 (the value \(1365.15\) uses 3.04); \(\mathrm{SSTR}\) appears as 302.67 and then 302.69, the exact value is 302.695; \(\hat C=2.373\) is rounded to 2.37 before squaring, and the printed \(\mathrm{SSC}=105.38\) and \(F=7.41\) match neither value (2.37 gives \(105.32\) and \(7.41\), 2.373 gives \(105.61\) and \(7.43\)); and \(Q_{.05,4,96}=3.71\) (interpolated from the table) is 3.698 exactly.
See also (companion courses): planned versus data-driven comparisons and the multiplicity they carry, Filling the gap 10.13 (Bonferroni).
pp. 604–605 The \(F\) test assumes that the \(Y_{ij}\) are independent, normal and have the same variance at every level. They are not equally easy to secure, nor equally harmful to lose. Independence matters most; randomising the order in which observations are made (relative to the levels) protects against systematic bias. Normality is hard to check but, as for the \(t\) test, moderate departures do little harm. Unequal variances are the worrying case: they distort the \(F\) test when the groups are unbalanced and invalidate intervals for individual means. The next box shows how much, and then the section shows how a transformation of the data can restore equal variances when the variance depends on the mean in a known way.
The book says that the \(F\) test is robust to non-normality and that unequal variances can be "unsettling". Both statements can be made exact. Unequal variances do not move the two mean squares equally, and how far the test is off depends on whether the noisy groups are the small ones; non-normality is harmless in large samples.
The \(F\) test is exact only when numerator and denominator have the stated laws. With unequal variances, compare the expected values of the two mean squares: which groups get large weights in each one?
Under equal means compute \(\E\,\mathrm{MSTR}\) and \(\E\,\mathrm{MSE}\) with \(\sigma_j^2\). Aim for: weights \(1-n_j/n\) for the first and \(n_j-1\) for the second.
Take equal sizes, then sizes \((5,10,20)\) with the noisy group small or large. Aim for: the ratio of the two expectations is 1, above 1 or below 1; relate it to a liberal or conservative test.
For non-normal data with equal variances let all \(n_j\to\infty\) and show \((k-1)F\to\chi^2_{k-1}\). Aim for: asymptotic size \(\alpha\); what is different for the \(F\) test of variances?
Unequal variances. Let all means be equal, with variances \(\sigma_j^2\) and sizes \(n_j\). By Filling the gap 12.1 (b), (c), \[ \E\,\mathrm{MSTR}=\frac{1}{k-1}\sum_j\Big(1-\frac{n_j}n\Big)\sigma_j^2,\qquad\E\,\mathrm{MSE}=\frac{1}{n-k}\sum_j(n_j-1)\sigma_j^2 .\] With equal sizes \(n_j=r\) both are the average variance \(\bar\sigma^2=\frac1k\sum\sigma_j^2\), and the ratio of means is 1: the \(F\) ratio is still centred correctly, and only its shape is slightly off (the numerator is a weighted sum of \(\chi^2_1\) variables, not a \(\chi^2_{k-1}\)). With unequal sizes the weights differ: \(\mathrm{MSTR}\) weights \(\sigma_j^2\) by \(1-n_j/n\) (large for small groups) and \(\mathrm{MSE}\) by \(n_j-1\) (large for large groups). If the small groups are the noisy ones the numerator is inflated relative to the denominator, the ratio of means exceeds 1 and \(H_0\) is rejected too often; if the large groups are noisy, the test becomes conservative. For sizes \((5,10,20)\) and standard deviations \((3,1,1)\) the two means are \(4.43\) and \(2.00\) (ratio 2.2) and the true level of the nominal 5% test is 0.24; for \((1,1,3)\) they are \(2.71\) and \(5.75\) (ratio 0.47) and the level is 0.009. With equal sizes 10, 10, 10 and standard deviations \((1,1,3)\) the ratio of means is 1 and the level is 0.077 (Figure x12.3(a)). (For \(k=2\) this is the pooled \(t\) test of Filling the gap 9.4, whose size depends on the same comparison.)
Non-normal data. Suppose the variances are equal, the \(Y_{ij}\) within a group are independent and identically distributed with a finite variance \(\sigma^2\) (not necessarily normal), the means are equal, and every \(n_j\to\infty\) with \(n_j/n\to p_j>0\). By the central limit theorem each \(W_j=\sqrt{n_j}(\bar Y_{\cdot j}-\mu)/\sigma\) tends to \(\N(0,1)\) and the \(W_j\) are independent, so \((W_1,\dots,W_k)\to\N(0,I_k)\) in law. As in Filling the gap 12.4, \(\mathrm{SSTR}/\sigma^2=\sum W_j^2-(\sum_j\sqrt{n_j/n}\,W_j)^2\) is a continuous function of \(\bm W\) and of \(n_j/n\to p_j\); its limit is \(\chi^2_{k-1}\) by the computation of that box. And \(\mathrm{MSE}\to\sigma^2\) in probability by the law of large numbers (each \(S_j^2\to\sigma^2\)). By Slutsky's theorem \((k-1)F\to\chi^2_{k-1}\), equivalently the \(F\) test has asymptotic size \(\alpha\). So the \(F\) test shares the robustness of the \(t\) test (Filling the gap 7.12) for large samples, but not that of Chapter 9's \(F\) test for variances (9.10), which depends on the fourth moment. For small samples from strongly skewed laws the approximation can be poor. ∎
Practical advice. Use equal group sizes when you can design the study: the damage from unequal variances is then mild. When sizes are unequal and the variances differ, use a transformation (below) or Welch's version of the one-way analysis of variance (Welch 1951), which weights groups by \(n_j/s_j^2\); it is not in the book.
fig_x12_3.pp. 604–605 Suppose \(Y_{ij}\) has a distribution \(f_Y(y;\mu_j)\) with mean \(\mu_j\) and a variance that is a known function of the mean, \(\V Y_{ij}=g(\mu_j)\) (Poisson counts: \(g(\mu)=\mu\)). The aim is a function \(A\) such that \(W_{ij}=A(Y_{ij})\) has the same variance \(c_1^2\) at every level. The book's argument is a first-order Taylor expansion: \(W_{ij}\approx A(\mu_j)+(Y_{ij}-\mu_j)A'(\mu_j)\), so \(\V W_{ij}\approx[A'(\mu_j)]^2g(\mu_j)\), and this equals \(c_1^2\) for every \(\mu_j\) when \(A'(\mu)=c_1/\sqrt{g(\mu)}\), that is \[ A(y)=c_1\int\frac{\d y}{\sqrt{g(y)}}+c_2.\tag{12.5.1}\] Constants \(c_1,c_2\) can be chosen to make \(A\) simple.
If \(Y_{ij}\) is Poisson with mean \(\mu_j\), then \(\V Y_{ij}=\mu_j=g(\mu_j)\), and (12.5.1) gives \(A(y)=c_1\int y^{-1/2}\d y=2c_1\sqrt y+c_2\). With \(c_1=\frac12\), \(c_2=0\): \(A(y)=\sqrt y\) (equation 12.5.2). Counts known to be Poisson should be replaced by their square roots before the analysis of variance; the transformed variables have variance close to \(\frac14\) whatever \(\mu_j\) is.
If \(Y_{ij}\) is binomial with parameters \(n\) and \(p_j\), then \(\E Y_{ij}=np_j=\mu_j\) and \(\V Y_{ij}=np_j(1-p_j)=\mu_j(1-\mu_j/n)\). Equation (12.5.1) requires \(\int dy/\sqrt{y(1-y/n)}\); the substitution \(y=n\sin^2\theta\) gives \(\d y=2n\sin\theta\cos\theta\,\d\theta\) and \(\sqrt{y(1-y/n)}=\sqrt n\sin\theta\cos\theta\), so the integral is \(2\sqrt n\,\theta=2\sqrt n\arcsin\sqrt{y/n}\). The transformation is \(A(y)=\arcsin\sqrt{y/n}\) (with \(c_1=1/(2\sqrt n)\)), which has variance close to \(1/(4n)\) whatever \(p_j\) is.
The book's expansion treats \(Y_{ij}-\mu_j\) as small and ignores the remainder. The statement that is actually true is the delta method, which says for which variables and in which sense; it also shows what other variance patterns lead to, and how the formula performs for small counts.
If \(Y\) is approximately normal with mean \(\mu\) and variance \(g(\mu)\), what is the approximate variance of \(A(Y)\)? Setting it constant gives a differential equation for \(A\); solve it for each variance function.
State the delta-method approximation and derive \(A'(\mu)=c_1/\sqrt{g(\mu)}\). Aim for: equation (12.5.1).
Solve it for \(g(\mu)=\mu^{2p}\) (all \(p\)) and for the binomial \(g=\mu(1-\mu/n)\). Aim for: \(y^{1-p}/(1-p)\), \(\ln y\) for \(p=1\), and \(2\sqrt n\arcsin\sqrt{y/n}\).
Look at the exact standard deviations of \(2\sqrt Y\) and \(2\sqrt{Y+3/8}\) for small \(\mu\). Aim for: where the first-order argument fails; what does the \(F\) test compare after transforming?
The delta method. Let \(A\) be differentiable at \(\mu\) with \(A'(\mu)\ne0\). If \(\sqrt m\,(T_m-\mu)\to\N(0,g(\mu))\) in law then \(\sqrt m\,(A(T_m)-A(\mu))\to\N(0,A'(\mu)^2g(\mu))\) (Theorem 5.13 of the graduate course; demo). A Poisson variable with large mean \(\mu\) is the sum of \(\mu\) independent Poisson(1) variables, a binomial \((n,p)\) variable a sum of \(n\) Bernoulli variables, so for large \(\mu\) or \(n\) the premise holds (central limit theorem) with \(g\) the variance function, and the conclusion is the book's \(\V A(Y)\approx A'(\mu)^2g(\mu)\). Setting this equal to a constant gives \(A'=c_1/\sqrt g\), i.e. (12.5.1).
Other variance functions. (a) \(g(\mu)=\mu^{2p}\) (standard deviation proportional to \(\mu^p\)): \(A'(\mu)=\mu^{-p}\), so \(A(y)=y^{1-p}/(1-p)\) for \(p\ne1\), and \(A(y)=\ln y\) for \(p=1\): a constant coefficient of variation calls for the logarithm, \(p=\frac12\) (variance proportional to the mean) for the square root. (b) The binomial computation of Example 12.5.2 is the case \(g(\mu)=\mu(1-\mu/n)\). (c) With the choice \(c_1=1\) in Example 12.5.1 the transformed Poisson count \(2\sqrt Y\) has variance \(\to1\).
How good for small counts? The Taylor argument needs \(Y\) to stay near \(\mu\), so it is poor when \(\mu\) is small. Exact standard deviations of Poisson counts (computed by summing the probability function):
so the plain square root is adequate from \(\mu\approx4\) on, and Anscombe's \(\sqrt{Y+3/8}\) (Anscombe 1948) is nearly exact even for small means; for binomial counts with \(n=20\) the standard deviation of \(2\sqrt n\arcsin\sqrt{Y/n}\) is between 1.03 and 1.24 for \(p\) from 0.1 to 0.7. ∎mean \(\mu\) 1 4 9 25 sd of \(Y\) 1.00 2.00 3.00 5.00 sd of \(2\sqrt Y\) 1.27 1.11 1.03 1.008 sd of \(2\sqrt{Y+3/8}\) 0.85 0.999 1.001 1.000
What the analysis then tests. After transformation the \(F\) test compares the means of \(A(Y_{ij})\), approximately \(A(\mu_j)\); for a strictly increasing \(A\) these are equal exactly when the \(\mu_j\) are (to first order), so \(H_0\) is still the question asked. Confidence intervals for the transformed means can be mapped back with \(A^{-1}\), but they then refer to \(A^{-1}(\E A(Y))\), which is not \(\mu\) (for the square root it is about \(\mu-\frac14\)), and a difference of transformed means is not a difference of original means. And a transformation repairs the variance only if the assumed relation \(\V Y=g(\mu)\) is right: the diagnostic is to plot the group standard deviations against the group means (Question 12.5.2).
See also (companion courses): the delta method demo; the use of variance-stabilising transformations for counts in Statistical Methods for Modern Biology, Chapter 13.
pp. 606–607 The closing section of the book steps back from technique to history. At the start of the twentieth century there was probability theory and there were skilled observers of random phenomena, but no body of statistical method: nobody knew the sampling laws of \(\bar Y\), of \(S^2\), of the \(t\) ratio or of a ratio of variances, so nothing beyond a point estimate could be said about a normal model. Karl Pearson derived the law of the goodness-of-fit statistic (Chapter 10) in 1900 and W. S. Gosset ("Student") the \(t\) law in 1908. R. A. Fisher (1890–1962) did more than anyone to fill the rest: he derived the sampling laws, developed the theory of estimation (the maximum likelihood, sufficiency and efficiency of Chapter 5), and, from 1919 at the Rothamsted agricultural station, created the design of experiments. His two principles were replication (repeat the treatment on several units to estimate the noise) and randomization (assign treatments by chance so that soil, drainage and every other nuisance is balanced on average, Filling the gap 8.5). The mathematics that makes comparisons in such designs possible is the analysis of variance; its test statistic is called \(F\) in his honour. His books Statistical Methods for Research Workers (1925) and The Design of Experiments (1935) taught several generations of scientists to design and analyse experiments.
The model in this chapter is the simplest design, one factor and complete randomization. Chapter 13 removes a known nuisance by blocking (the randomized block design of Section 8.2.5), and Chapter 15 studies two or more factors together; each adds one row to the ANOVA table of this chapter, and each is analysed with the same ingredients: sums of squares that add, independent chi-squared laws, and ratios that follow \(F\) laws.
The proof of Theorem 12.2.5(b) writes \[ \E[\mathrm{SSTR}/(k-1)]=\sigma^2+\frac1{k-1}\sum_{j=1}^k(\mu_j-\mu)^2.\] By Theorem 12.2.1 the sum should be \(\sum_jn_j(\mu_j-\mu)^2\); the printed formula is right only when every \(n_j=1\). The argument that follows uses only the sign of the extra term and is unaffected. See Filling the gap 12.1.
The total \(T_{\cdot4}=25\times15.52=388.00\) is printed as 388.60 in the line for \(C\); \(\mathrm{SSE}\) shows \((3.01)^2\) for the fourth group instead of \((3.04)^2\); \(\mathrm{SSTR}\) is given as 302.67 and as 302.69 (exact 302.695); the contrast estimate is rounded to 2.37 before squaring, and the printed \(\mathrm{SSC}=105.38\) fits neither 2.37 (\(105.32\)) nor the exact 2.373 (\(105.61\), \(F=7.43\)); \(Q_{.05,4,96}\) is interpolated as 3.71 (exact 3.698) and \(F_{.95,1,96}\) as \(\doteq3.95\) (exact 3.940). The final numbers \(\mathrm{SSE}=1365.15\), \(F=7.10\) and every conclusion stand. See Filling the gap 12.16.
The book rounds means and mean squares before forming intervals and ratios. Recomputing from the printed data (or summaries) gives slightly different values; none changes a conclusion.
| Quantity | book | unrounded |
|---|---|---|
| CS 12.2.1: group means | 62.3, 63.2, 71.7, 81.7 | 62.33, 63.17, 71.67, 81.67 |
| CS 12.3.1: \(\mathrm{MSE}\), \(D\sqrt{\mathrm{MSE}}\) | 9.06, 6.58 | 9.055, 6.57 |
| CS 12.3.1: interval for \(\mu_1-\mu_2\) | (−9.38, 3.78) | (−9.35, 3.80) |
| CS 12.4.1: \(\mathrm{SSC}_1\), \(F_1\) | 4.68, 2.03 | 4.69, 2.04 |
| CS 12.4.2: \(\mathrm{SSTR}\), \(F\) | 302.67 or 302.69, 7.10 | 302.695, 7.095 |
Recomputed from the printed data, the book's answers to Questions 12.2.1, 12.2.3, 12.2.5, 12.2.7, 12.3.1, 12.3.3 and 12.4.1 (and the arithmetic of 12.4.4, whose note \(\mathrm{SSE}=147.17429\) is correct) agree with ours to the printed precision.
Ten of the book's questions, restated in my own words, covering every section of the chapter (the \(F\) test and its table, the equivalence with the \(t\) test, Tukey's intervals, contrasts, transformations and power), with complete solutions (hidden). Numbers were cross-checked with the book's answers to the odd-numbered questions, which they match except where noted in Notes on the book.
Question 12.2.1 (gas mileage of four sedans). Road tests of four new models of luxury sedan gave these mileages (miles per gallon): model A: 22, 26; model B: 28, 24, 29; model C: 29, 32, 28; model D: 23, 24. Test that all four models give the same average mileage at \(\alpha=0.05\). Does the conclusion change at \(\alpha=0.10\)? (Data: Question 12.2.1 of Larsen and Marx 2018.)
Group the ten mileages by model (sizes 2, 3, 3, 2), compute \(\mathrm{SSTR}\) and \(\mathrm{SSE}\) with the computing formulas, then compare \(F\) with the cut-offs at the two levels.
Find the totals \(T_{\cdot j}\), \(T_{\cdot\cdot}\), \(C\) and \(\sum Y_{ij}^2\). Aim for: \(T_{\cdot\cdot}=265\), \(C=7022.5\), \(\mathrm{SSTOT}=92.5\).
Compute \(\mathrm{SSTR}\), then \(\mathrm{SSE}\) by subtraction and the mean squares. Aim for: \(\mathrm{SSTR}=61.33\) (3 df) and \(\mathrm{MSE}=5.19\) (6 df).
Form \(F\) and decide at \(\alpha=0.05\) and \(0.10\). Aim for: \(F\approx3.94\) between the two cut-offs 4.76 and 3.29; say what it means for the \(P\)-value.
Here \(k=4\), \(n=10\), with sizes \((2,3,3,2)\), totals \(T_{\cdot j}=48,\ 81,\ 89,\ 47\) and \(T_{\cdot\cdot}=265\). Use the computing formulas (12.2.4) and (12.2.5): \(C=265^2/10=7022.5\), \(\sum Y_{ij}^2=7115\), so \[ \mathrm{SSTOT}=7115-7022.5=92.5,\qquad\mathrm{SSTR}=\frac{48^2}2+\frac{81^2}3+\frac{89^2}3+\frac{47^2}2-C=7083.83-7022.5=61.33,\] \(\mathrm{SSE}=92.5-61.33=31.17\). The ANOVA table:
| Source | df | SS | MS | \(F\) |
|---|---|---|---|---|
| Models | 3 | 61.33 | 20.44 | 3.94 |
| Error | 6 | 31.17 | 5.19 | |
| Total | 9 | 92.50 |
At \(\alpha=0.05\) the cut-off is \(F_{.95,3,6}=4.757\) and \(3.94<4.757\): do not reject. At \(\alpha=0.10\) it is \(F_{.90,3,6}=3.289\) and \(3.94>3.289\): reject. (The exact \(P\)-value is 0.072.) So the conclusion does change, which is just what a \(P\)-value between the two levels means; it is more informative to report \(P=0.072\) than the decision. With only two or three cars per model the test has little power, and the data are weak evidence either way: the estimated standard deviation \(\sqrt{\mathrm{MSE}}=2.3\) mpg is comparable to the spread of the group means (23.5 to 29.7), so differences of a few mpg are within noise.
Question 12.2.7 (completing an ANOVA table). In a one-way ANOVA the following entries are known: treatment df 4, \(F=6.40\), error mean square 10.60, total sum of squares 377.36. Fill in the rest of the table. (Data: Question 12.2.7 of Larsen and Marx 2018.)
The table is held together by three relations: \(F=\mathrm{MSTR}/\mathrm{MSE}\), \(\mathrm{MS}=\mathrm{SS}/\mathrm{df}\), and additivity of sums of squares and of degrees of freedom. Which blank can you fill first?
Use \(F\) and \(\mathrm{MSE}\) to get \(\mathrm{MSTR}\), then \(\mathrm{SSTR}\). Aim for: \(\mathrm{MSTR}=67.84\), \(\mathrm{SSTR}=271.36\).
Get \(\mathrm{SSE}\) by subtraction and the error df from \(\mathrm{SSE}/\mathrm{MSE}\), then the total df. Aim for: \(\mathrm{SSE}=106.00\), error df 10, total df 14.
Work from the identities of the table. \(F=\mathrm{MSTR}/\mathrm{MSE}\) gives \(\mathrm{MSTR}=6.40\times10.60=67.84\); then \(\mathrm{SSTR}=(k-1)\mathrm{MSTR}=4\times67.84=271.36\). Additivity of sums of squares gives \(\mathrm{SSE}=\mathrm{SSTOT}-\mathrm{SSTR}=377.36-271.36=106.00\), and \(\mathrm{MSE}=\mathrm{SSE}/(n-k)\) gives the error df \(=106.00/10.60=10\). Total df is \(4+10=14\) (so \(k=5\) levels and \(n=15\) observations).
| Source | df | SS | MS | \(F\) |
|---|---|---|---|---|
| Treatment | 4 | 271.36 | 67.84 | 6.40 |
| Error | 10 | 106.00 | 10.60 | |
| Total | 14 | 377.36 |
(Since \(F_{.95,4,10}=3.48\) and \(6.40\) exceeds it, \(P=0.008\), the null hypothesis of equal means would be rejected.) The exercise shows the structure of the table: four given entries (here the treatment df, \(F\), \(\mathrm{MSE}\) and \(\mathrm{SSTOT}\)) determine the rest.
Question 12.2.12 (Mark Twain and the analysis of variance). Run an analysis of variance on the proportions of three-letter words of Case Study 9.2.1 (eight Twain essays and ten Quintus Curtius Snodgrass essays), and verify that the observed \(F\) is the square of the two-sample \(t\) ratio. (Data: Table 9.2.1; Question 12.2.12 of Larsen and Marx 2018.)
For two groups the treatment sum of squares collapses to a multiple of \((\bar y_1-\bar y_2)^2\) and \(\mathrm{SSE}\) to \((n+m-2)s_p^2\). Compute both and compare \(F\) with the square of the \(t\) ratio.
Compute \(\mathrm{SSTR}=\frac{nm}{n+m}(\bar x-\bar y)^2\) and \(\mathrm{SSE}=(n+m-2)s_p^2\) for \(n=8\), \(m=10\). Aim for: \(0.002185\) and \(0.002325\).
Form \(F\) on 1 and 16 df and square the \(t\) of the case study. Aim for: \(F=15.04=3.878^2\).
Compare the cut-offs at \(\alpha=0.01\). Aim for: \(F_{.99,1,16}=8.53=t_{.005,16}^2\), so the tests reject together.
With \(k=2\), \(n_1=8\), \(n_2=10\), \(\bar y_1=0.2319\), \(\bar y_2=0.2097\), \(\bar y_{\cdot\cdot}=0.2196\): \[ \mathrm{SSTR}=\frac{n_1n_2}{n_1+n_2}(\bar y_1-\bar y_2)^2=\frac{80}{18}(0.02218)^2=0.002185,\qquad\mathrm{SSE}=(n_1-1)s_1^2+(n_2-1)s_2^2=0.002325,\] on 1 and 16 degrees of freedom, so \(\mathrm{MSE}=0.0001453\) (this is \(s_p^2\), \(s_p=0.0121\)) and \(F=0.002185/0.0001453=15.04\). The pooled \(t\) ratio of Case Study 9.2.1 is \(t=3.878\) with \(3.878^2=15.04\). The critical values are related in the same way: at \(\alpha=0.01\) the \(F\) cut-off is \(F_{.99,1,16}=8.53\) and \(t_{.005,16}^2=2.9208^2=8.53\); the \(P\)-value, \(0.0013\), is the same for both. So the two tests reject together, as Example 12.2.2 says. In general \(\mathrm{SSTR}=\frac{n_1n_2}{n_1+n_2}(\bar y_1-\bar y_2)^2\) and \(\mathrm{SSE}=(n-2)s_p^2\), so \(F=(\bar y_1-\bar y_2)^2/[s_p^2(1/n_1+1/n_2)]=t^2\) (Filling the gap 8.10).
Question 12.3.1 (Tukey's method for the heart rates). Use Tukey's method to compare all pairs of mean heart rates of Case Study 12.2.1 (nonsmokers, light, moderate, heavy smokers; six subjects each) at the 0.05 level.
All six differences of means get the same half-width \(D\sqrt{\mathrm{MSE}}\) with \(D=Q_{\alpha,k,n-k}/\sqrt r\). Find \(\mathrm{MSE}\), the studentised-range point, and then compare each difference with the half-width.
Get \(\mathrm{MSE}\) and \(D\sqrt{\mathrm{MSE}}\). Aim for: \(\mathrm{MSE}=79.74\), \(Q=3.96\), half-width about \(14.4\).
List the six differences of means and attach intervals. Aim for: which intervals exclude 0.
Summarise, and draw the underlining. Aim for: only heavy smokers against nonsmokers and light smokers. Why is moderate against heavy not separated?
From the ANOVA, \(\mathrm{MSE}=79.74\) on \(\nu=20\) degrees of freedom, \(k=4\), \(r=6\). The Studentized-range point is \(Q_{.05,4,20}=3.958\) (Table A.5: 3.96), so \(D=3.958/\sqrt6=1.616\) and \(D\sqrt{\mathrm{MSE}}=1.616\times8.929=14.43\). The means are \(62.33,\ 63.17,\ 71.67,\ 81.67\). The six 95% simultaneous intervals are the differences \(\pm14.43\):
| Pair | difference | interval | Conclusion |
|---|---|---|---|
| \(\mu_1-\mu_2\) | −0.83 | (−15.26, 13.60) | not rejected |
| \(\mu_1-\mu_3\) | −9.33 | (−23.76, 5.10) | not rejected |
| \(\mu_1-\mu_4\) | −19.33 | (−33.76, −4.90) | reject |
| \(\mu_2-\mu_3\) | −8.50 | (−22.93, 5.93) | not rejected |
| \(\mu_2-\mu_4\) | −18.50 | (−32.93, −4.07) | reject |
| \(\mu_3-\mu_4\) | −10.00 | (−24.43, 4.43) | not rejected |
(The book's answers, e.g. \((-15.27,\,13.60)\), differ in the last digit through rounding of \(Q\).) Only heavy smokers are separated, from nonsmokers and from light smokers; moderate smokers cannot be told apart from anyone, even though their mean is 10 beats per minute below the heavy smokers'. Underlining the means in increasing order: one line under nonsmokers, light and moderate, another under moderate and heavy. The overall \(F\) test (\(P=0.004\)) shows that the four means differ; the simultaneous intervals, with only six subjects per group, show where the evidence is strong enough to point.
Question 12.3.6 (non-transitivity of "not different"). If 95% Tukey intervals reject \(H_0\colon\mu_1=\mu_2\) and \(H_0\colon\mu_1=\mu_3\), must they reject \(H_0\colon\mu_2=\mu_3\)? Explain, and give an example from data of this chapter.
Rejection of a pair means the difference of sample means is at least the half-width \(h\). It does not say on which side of \(\bar y_1\) the other two means lie. What is the distance between \(\bar y_2\) and \(\bar y_3\) if they are on the same side?
Place \(\bar y_2\) and \(\bar y_3\) relative to \(\bar y_1\), both on the same side and then on opposite sides. Aim for: in which case is \(|\bar y_2-\bar y_3|\ge2h\)?
Give a numerical example from the case study. Aim for: two means (1 and 2) both separated from erythromycin (4) but not from each other.
No. Rejection of a pair means \(|\bar y_{\cdot i}-\bar y_{\cdot j}|\ge D\sqrt{\mathrm{MSE}}=:h\), the common half-width. Rejecting \(\mu_1=\mu_2\) and \(\mu_1=\mu_3\) says that \(\bar y_{\cdot2}\) and \(\bar y_{\cdot3}\) are each at least \(h\) away from \(\bar y_{\cdot1}\), but not on which side. If they are on opposite sides of \(\bar y_{\cdot1}\), their distance is at least \(2h>h\) and \(\mu_2=\mu_3\) is rejected too. If they are on the same side they may lie close together (e.g. \(\bar y_{\cdot2}-\bar y_{\cdot1}=1.1h\) and \(\bar y_{\cdot3}-\bar y_{\cdot1}=1.3h\) give a difference of \(0.2h\)), and \(\mu_2=\mu_3\) is not rejected.
A real example: in Case Study 12.3.1 (\(h=6.57\)), erythromycin (4, mean 19.08) is separated from penicillin G (1, mean 28.60) and from tetracycline (2, mean 31.38), but penicillin G and tetracycline are not separated from each other (difference 2.78). The lesson is that "not rejected" is not "equal": it means the data cannot tell. Failure to reject is not transitive, which is why the pictures of Figure 12.3.2 sometimes contain overlapping lines, and why the \(\binom k2\) conclusions of Tukey's method cannot be summarised as a partition of the means into classes.
Question 12.4.3 (a contrast on the heart-rate data). In Case Study 12.2.1, test at \(\alpha=0.05\) the hypothesis that the average of the true mean heart rates of light and moderate smokers equals that of heavy smokers. Would the conclusion hold if the comparison had been chosen after looking at the data?
State the subhypothesis as a contrast with coefficients summing to zero, estimate it from the group means, and test it with \(F=\mathrm{SSC}/\mathrm{MSE}\) on 1 and \(n-k\) degrees of freedom.
Write the contrast \((0,\frac12,\frac12,-1)\) and compute \(\hat C\) and \(\sum c_j^2/n_j\). Aim for: \(\hat C=-14.25\), \(\sum c_j^2/n_j=0.25\).
Compute \(\mathrm{SSC}\) and \(F\), compare with \(F_{.95,1,20}\). Aim for: \(F\approx10.2\) against 4.35.
Redo the comparison with the Scheffé cut-off \(3F_{.95,3,20}\) in case the contrast was chosen after the data. Aim for: the conclusion still stands, narrowly.
The subhypothesis is \(H_0\colon\frac12\mu_2+\frac12\mu_3-\mu_4=0\), the contrast with coefficients \((0,\frac12,\frac12,-1)\) (they sum to 0). With the group means \(63.17,\ 71.67,\ 81.67\) and \(n_j=6\), \[ \hat C=\tfrac12(63.17)+\tfrac12(71.67)-81.67=-14.25,\qquad\sum\frac{c_j^2}{n_j}=\frac{\frac14+\frac14+1}6=0.25,\] \[ \mathrm{SSC}=\frac{(-14.25)^2}{0.25}=812.25,\qquad F=\frac{812.25}{\mathrm{MSE}}=\frac{812.25}{79.74}=10.19\] on 1 and 20 degrees of freedom. Since \(F_{.95,1,20}=4.351\) and \(10.19>4.351\), reject \(H_0\) (\(P=0.0046\)): the mean for heavy smokers is higher than the average of the other two groups, by an estimated 14.3 beats per minute (a 95% interval: \(-14.25\pm2.086\sqrt{79.74\times0.25}=(-23.6,\,-4.9)\)).
If the comparison had been suggested by the data (heavy is the largest mean), the right yardstick is Scheffé's: \((k-1)F_{.95,3,20}=3\times3.098=9.30\). Since \(10.19>9.30\) the conclusion survives, but only just; with the planned cut-off 4.35 it passes easily.
Question 12.4.6 (nitrosopyrrolidine in bacon). The amount of nitrosopyrrolidine (ppb) recovered after frying three slices of each of four commercial brands of bacon was: A: 20, 40, 18; B: 75, 25, 21; C: 15, 30, 21; D: 25, 30, 31. Do the analysis of variance and split the treatment sum of squares into three mutually orthogonal contrasts: \(C_1\colon\mu_A=\mu_B\), \(C_2\colon(\mu_A+\mu_B)/2=(\mu_C+\mu_D)/2\) and a third; test each at the 0.05 level. (Data: Question 12.4.6 of Larsen and Marx 2018.)
Do the one-way ANOVA first, then build three contrasts whose coefficient vectors are mutually orthogonal and compute \(\mathrm{SSC}\) for each. Their sum should reproduce \(\mathrm{SSTR}\).
Compute the four brand means, \(\mathrm{SSTR}\), \(\mathrm{SSE}\), \(F\). Aim for: \(\mathrm{SSTR}=558.92\) (3 df), \(\mathrm{SSE}=2241.33\) (8 df).
Find the third contrast: orthogonal to \((1,-1,0,0)\) and \((\frac12,\frac12,-\frac12,-\frac12)\) with coefficients summing to zero. Aim for: \((0,0,1,-1)\).
Compute \(\hat C_i\), \(\mathrm{SSC}_i\) and \(F_i\) for each, and add. Aim for: 308.17, 184.08, 66.67, total 558.92; compare each \(F\) with 5.32.
Brand means \(26.0,\ 40.33,\ 22.0,\ 28.67\); grand mean 29.25, \(n=12\), \(k=4\). \(\mathrm{SSTR}=3\sum(\bar y_{\cdot j}-29.25)^2=558.92\) on 3 df and \(\mathrm{SSE}=2241.33\) on 8 df, \(\mathrm{MSE}=280.17\), \(F=186.31/280.17=0.665\) (\(P=0.60\), \(F_{.95,3,8}=4.066\)): no evidence that the brands differ.
With equal sizes, orthogonality of two contrasts means \(\sum_jc_{sj}c_{tj}=0\). A third contrast \((a,b,c,d)\) orthogonal to \(C_1=(1,-1,0,0)\) needs \(a=b\); orthogonal to \(C_2=(\frac12,\frac12,-\frac12,-\frac12)\) it needs \(a+b=c+d\); with \(a+b+c+d=0\) these force \(a=b=0\) and \(c=-d\). So take \(C_3\colon\mu_C=\mu_D\). The three values of \(\sum c_j^2/n_j\) are \(2/3\), \(1/3\), \(2/3\):
| contrast | \(\hat C\) | SSC | \(F=\mathrm{SSC}/\mathrm{MSE}\) |
|---|---|---|---|
| \(C_1=\mu_A-\mu_B\) | −14.33 | 308.17 | 1.10 |
| \(C_2=\frac12(\mu_A+\mu_B)-\frac12(\mu_C+\mu_D)\) | 7.83 | 184.08 | 0.66 |
| \(C_3=\mu_C-\mu_D\) | −6.67 | 66.67 | 0.24 |
| total | 558.92 |
The three add to 558.92 \(=\mathrm{SSTR}\), as Theorem 12.4.1 says. None exceeds \(F_{.95,1,8}=5.318\), so no subhypothesis is rejected. Note how the data behave: brand B has one value of 75 ppb that dominates its mean and the error sum of squares (the within-brand standard deviations are 12.2, 30.1, 7.5 and 3.2 ppb, which also violates equal variances), and three slices per brand give very little power. A transformation (logarithm: the spread grows with the mean) would be a natural first step in a real analysis.
Question 12.5.2 (which transformation?). An experimenter has five treatment groups with three replicates each, and has computed the group means \(\bar y_{\cdot j}=9,\ 4,\ 16,\ 9,\ 1\) and standard deviations \(s_j=3,\ 2,\ 4,\ 3,\ 1\). What should she do before computing the sums of squares? Be as quantitative as possible. (Data: Question 12.5.2 of Larsen and Marx 2018.)
Look at how the group standard deviations depend on the group means. Here \(s_j^2\) equals \(\bar y_{\cdot j}\) in every group: which variance function \(g(\mu)\) is that, and which transformation does equation (12.5.1) give?
Tabulate \(s_j^2\) against \(\bar y_{\cdot j}\) and \(s_j/\bar y_{\cdot j}\). Aim for: variance equal to the mean in every group, but a standard deviation that is not proportional to the mean.
Name the transformation and predict the variance of the transformed data. Aim for: \(\sqrt y\), variance \(\approx\frac14\) in each group instead of a spread of 1 to 16.
Comment on small means and few replicates. Aim for: why \(\sqrt{y+3/8}\) may be safer for the group with mean 1.
The group variances are \(9,4,16,9,1\): they range over a factor of 16 and, more to the point, they are exactly equal to the group means: \(s_j^2=\bar y_{\cdot j}\) for every \(j\). The equal-variance assumption of the \(F\) test is violated in a systematic way, a variance function \(g(\mu)=\mu\), the Poisson pattern (if the observations are counts; more generally variance proportional to the mean). By Section 12.5 the stabilising transformation is \(A(y)=\sqrt y\) (equation 12.5.2): replace every observation by its square root, then do the analysis of variance on the \(\sqrt{y_{ij}}\). Its predicted effect: \(\V\sqrt Y\approx g(\mu)/(4\mu)=1/4\), so all five transformed standard deviations should be close to \(0.5\) instead of ranging from 1 to 4 (a ratio of 16 in the variances becomes about 1).
Two checks on the choice. The ratio \(s_j/\bar y_{\cdot j}=0.33,\ 0.5,\ 0.25,\ 0.33,\ 1.0\) is far from constant, so a logarithm (constant coefficient of variation) is not indicated, while \(s_j/\sqrt{\bar y_{\cdot j}}=1\) for every group. And with only three replicates the group means and variances are rough; the group with mean 1 has very small values, for which \(\sqrt{y+3/8}\) is a better version of the transformation (see Filling the gap 12.18). The advice is conditional on the justification that the data are counts or otherwise have variance proportional to their mean.
Question 12.5.3 (three missile launchers). Each of three launchers fires four rounds of twenty missiles; a hit is a missile landing within ten yards of the target. The numbers of hits per round are: launcher A: 13, 11, 10, 14; B: 15, 16, 18, 17; C: 9, 11, 10, 8. Compare the accuracy of the launchers by an analysis of variance after a suitable transformation, at \(\alpha=0.05\). (Data: Question 12.5.3 of Larsen and Marx 2018.)
Each number is a count of hits out of 20, so it is binomial with a variance that depends on the hit probability. Which transformation stabilises that variance, and what does the ANOVA then compare?
Transform each count to \(\arcsin\sqrt{y/20}\) (radians) and find the group means. Aim for: \(0.887\), \(1.144\), \(0.760\).
Compute \(\mathrm{SSTR}\), \(\mathrm{SSE}\) and \(F\). Aim for: \(F\approx22.3\) on 2 and 9 df against 4.26.
Redo the analysis on the raw counts and compare. Aim for: \(F=22.65\); why is the transformation not essential here (look at \(20p(1-p)\))?
Each count is binomial with \(n=20\) and probability \(p_j\) of a hit (if missiles are independent), with variance \(20p_j(1-p_j)\) depending on \(p_j\): by Example 12.5.2 use \(A(y)=\arcsin\sqrt{y/20}\) (radians). The estimated hit rates are \(0.600,\ 0.825,\ 0.475\) and the transformed group means \(0.887,\ 1.144,\ 0.760\), with grand mean \(0.930\). Then \(\mathrm{SSTR}=4\sum(\bar a_{\cdot j}-0.930)^2=0.3059\) on 2 df and \(\mathrm{SSE}=0.0616\) on 9 df, so \(\mathrm{MSE}=0.00685\) and \[ F=\frac{0.3059/2}{0.0616/9}=22.3,\qquad F_{.95,2,9}=4.256,\quad P=0.0003.\] Reject \(H_0\colon p_A=p_B=p_C\): the launchers differ in accuracy; launcher B is best (82% hits) and C worst (48%).
Remarks. The transformation changes little here: the analysis of the raw counts gives \(F=22.65\) (SSTR \(=100.67\), SSE \(=20.0\)). This is no accident: the binomial variances \(20p(1-p)\) for \(p=0.48,0.60,0.83\) are \(5.0,\ 4.8,\ 2.9\), a ratio under 2, not a large violation. The transformed observations should have variance \(\approx1/(4\cdot20)=0.0125\); the pooled estimate is \(0.0068\), lower than predicted (a ratio as small as this occurs about one time in six by chance with 9 degrees of freedom), which with four rounds per launcher is not alarming but suggests that hits within a round may not be independent binomial trials. A comparison of launchers by pairs would use Tukey's method on the transformed data.
Question 12.A.2.1 (power against two alternatives). An experimenter takes three independent measurements at each of five treatment levels and tests \(H_0\colon\mu_1=\dots=\mu_5\) (\(=0\)) with the \(F\) test. Two possible alternatives are \(H_1^*\colon\mu=(-1,2,0,1,-2)\) and \(H_1^{**}\colon\mu=(-3,2,1,0,0)\). Against which does the test have the greater power? (Data: Question 12.A.2.1 of Larsen and Marx 2018.)
The power of the \(F\) test depends on the true means only through the noncentrality parameter \(\gamma\), and it increases with \(\gamma\). So compare the two values of \(\gamma\).
Find \(\mu\) for each alternative and the deviations \(\mu_j-\mu\). Aim for: both average 0.
Compute \(\gamma^*\) and \(\gamma^{**}\) with \(n_j=3\). Aim for: \(30/\sigma^2\) and \(42/\sigma^2\); state which alternative is easier to detect and why range is not the criterion.
By Theorem 12.A.2.2 the \(F\) ratio under a given alternative is noncentral \(F'_{4,10}(\gamma)\) with \(\gamma=\sum n_j(\mu_j-\mu)^2/\sigma^2\), and the power increases with \(\gamma\) (Filling the gap 12.9); the power against each alternative depends on the means only through \(\gamma\). Both alternatives have average 0 (so \(\mu=0\)), and \(n_j=3\): \[ \gamma^*=\frac{3(1+4+0+1+4)}{\sigma^2}=\frac{30}{\sigma^2},\qquad\gamma^{**}=\frac{3(9+4+1+0+0)}{\sigma^2}=\frac{42}{\sigma^2}.\] Since \(\gamma^{**}>\gamma^*\), the \(F\) test has the greater power against \(H_1^{**}\), whatever \(\sigma\) is. Numerically (\(\alpha=0.05\), cut-off \(F_{.95,4,10}=3.478\)): for \(\sigma=1\) the powers are \(0.949\) and \(0.991\); for \(\sigma=2\) they are \(0.383\) and \(0.520\). Note that it is the sum of squared deviations that counts, not the range (\(H_1^*\) has range 4, \(H_1^{**}\) range 5, but \(\sum\mu_j^2\) is what matters here) nor how many means differ.
Each demonstration runs in the browser and links back to these notes. The ▶ Demo boxes above open them already set to the case under discussion.
| Demonstration | What you can see | Sections and results |
|---|---|---|
| The F test and its power | Seeded one-way experiments with a chosen number of groups, group size, standard deviation and pattern of true means (none, one group high, evenly spread, two clusters, the heart-rate means of Case Study 12.2.1): the last data set with its group means, the ANOVA table, and the histogram of \(F\) over all experiments with the central \(F\) curve (\(H_0\)) and the noncentral \(F\) curve (the truth) and the rejection rate against the exact power. Presets: 1 all means equal; 2 the heart-rate means; 3 the same with half the group size; 4 one group shifted; 5 two clusters, same \(\gamma\) as preset 4; 6 two groups (\(F=t^2\)). | Section 12.2; Appendix 12.A.2; 12.1, 12.8, 12.9; Question 12.A.2.1 |
| Many tests, one error rate: Tukey's method | Seeded experiments with \(k\) means and \(r\) observations each: the last experiment's means with Tukey's simultaneous half-width and lines under the means it does not separate; running familywise error rates of all pairwise \(t\) tests, Bonferroni and Tukey against the exact values; with some true differences, the share of true differences found. Presets: 1 three equal means; 2 five equal means; 3 ten equal means; 4 the antibiotic means of Case Study 12.3.1; 5 the heart-rate means of Case Study 12.2.1. | Section 12.3; 12.10 to 12.12; Question 12.3.1 |
Related demonstrations from other courses: Pooled or Welch, paired or not (the two-group case of Filling the gap 12.17), Power and sample size (12.9), The family-wise error rate: Bonferroni and Holm (12.12), Variance-stabilising transformations and The delta method (12.18), and, from earlier chapters, How robust is the t test? (12.17).