Contrasts & Multiple Comparisons
A global ANOVA asks whether all means are equal. Contrasts answer focused questions, and multiple-comparison procedures control error across a family of claims.
The worked examples continue the one-way ANOVA example : A, B, and C have means 6, 8, and 11, with four observations each, M S E = 2 / 3 MSE=2/3 MSE = 2/3 , and 9 residual degrees of freedom.
Contrasts: Focused Questions About Means ¶ A contrast is a linear combination
C = ∑ i = 1 m c i μ i , ∑ i c i = 0. C=\sum_{i=1}^m c_i\mu_i,\qquad\sum_i c_i=0. C = i = 1 ∑ m c i μ i , i ∑ c i = 0. The zero-sum condition removes the overall level, leaving a comparison.
Question for A, B, C Coefficients ( c A , c B , c C ) (c_A,c_B,c_C) ( c A , c B , c C ) A minus B ( 1 , − 1 , 0 ) (1,-1,0) ( 1 , − 1 , 0 ) C minus the average of A and B ( − 1 / 2 , − 1 / 2 , 1 ) (-1/2,-1/2,1) ( − 1/2 , − 1/2 , 1 ) Linear trend across three equally spaced levels ( − 1 , 0 , 1 ) (-1,0,1) ( − 1 , 0 , 1 ) Curvature across three equally spaced levels ( 1 , − 2 , 1 ) (1,-2,1) ( 1 , − 2 , 1 )
Under the independent common-variance one-way model,
C ^ = ∑ i c i Y ˉ i ⋅ , SE ( C ^ ) = M S E ∑ i c i 2 n i . \widehat C=\sum_i c_i\bar Y_{i\cdot},\qquad
\operatorname{SE}(\widehat C)=\sqrt{MSE\sum_i\frac{c_i^2}{n_i}}. C = i ∑ c i Y ˉ i ⋅ , SE ( C ) = MSE i ∑ n i c i 2 . T C = C ^ − C 0 SE ( C ^ ) ∼ t N − m under H 0 : C = C 0 . T_C=\frac{\widehat C-C_0}{\operatorname{SE}(\widehat C)}\sim t_{N-m}
\quad\text{under }H_0:C=C_0. T C = SE ( C ) C − C 0 ∼ t N − m under H 0 : C = C 0 . An individual two-sided confidence interval is
C ^ ± t 1 − α / 2 , N − m SE ( C ^ ) . \widehat C\pm t_{1-\alpha/2,N-m}\operatorname{SE}(\widehat C). C ± t 1 − α /2 , N − m SE ( C ) . For testing C = 0 C=0 C = 0 , define
S S C = C ^ 2 ∑ i c i 2 / n i , F C = S S C M S E = T C 2 ∼ F 1 , N − m . SS_C=\frac{\widehat C^2}{\sum_i c_i^2/n_i},\qquad
F_C=\frac{SS_C}{MSE}=T_C^2\sim F_{1,N-m}. S S C = ∑ i c i 2 / n i C 2 , F C = MSE S S C = T C 2 ∼ F 1 , N − m . Here S S C SS_C S S C denotes a contrast sum of squares, not the total condition sum of squares.
For the ANOVA example, use c = ( − 1 / 2 , − 1 / 2 , 1 ) c=(-1/2,-1/2,1) c = ( − 1/2 , − 1/2 , 1 ) :
C ^ = 11 − 6 + 8 2 = 4. \widehat C=11-\frac{6+8}{2}=4. C = 11 − 2 6 + 8 = 4. SE ( C ^ ) = 2 3 ( 1 / 4 4 + 1 / 4 4 + 1 4 ) = 0.5. \operatorname{SE}(\widehat C)
=\sqrt{\frac23\left(\frac{1/4}{4}+\frac{1/4}{4}+\frac14\right)}=0.5. SE ( C ) = 3 2 ( 4 1/4 + 4 1/4 + 4 1 ) = 0.5. Thus t = 8 t=8 t = 8 on 9 df. The individual 95% confidence interval is
4 ± 2.2622 ( 0.5 ) = ( 2.8689 , 5.1311 ) . 4\pm2.2622(0.5)=(2.8689,5.1311). 4 ± 2.2622 ( 0.5 ) = ( 2.8689 , 5.1311 ) . The contrast SS is 4 2 / ( 3 / 8 ) = 42.6667 4^2/(3/8)=42.6667 4 2 / ( 3/8 ) = 42.6667 , giving F = 64 = t 2 F=64=t^2 F = 64 = t 2 .
For the contrast A minus B, S S C = ( − 2 ) 2 / ( 1 / 4 + 1 / 4 ) = 8 SS_C=(-2)^2/(1/4+1/4)=8 S S C = ( − 2 ) 2 / ( 1/4 + 1/4 ) = 8 . These two contrasts are orthogonal and their sums of squares add to 42.6667 + 8 = 50.6667 42.6667+8=50.6667 42.6667 + 8 = 50.6667 , the treatment SS.
Multiplying all coefficients by a nonzero constant scales the estimate and SE; the two-sided test conclusion stays the same. A negative multiplier reverses the interpretation of a one-sided alternative.
Orthogonal & Polynomial Contrasts ¶ Two contrast estimates have covariance
Cov ( C ^ , D ^ ) = σ 2 ∑ i c i d i n i . \operatorname{Cov}(\widehat C,\widehat D)=\sigma^2\sum_i\frac{c_i d_i}{n_i}. Cov ( C , D ) = σ 2 i ∑ n i c i d i . They are orthogonal when ∑ i c i d i / n i = 0 \sum_i c_i d_i/n_i=0 ∑ i c i d i / n i = 0 . With equal group sizes this reduces to ∑ i c i d i = 0 \sum_i c_i d_i=0 ∑ i c i d i = 0 . There are at most m − 1 m-1 m − 1 mutually orthogonal nonzero contrasts. A full orthogonal set partitions treatment SS.
For equally spaced numeric levels and equal replication:
Number of levels Linear Quadratic Cubic 3 ( − 1 , 0 , 1 ) (-1,0,1) ( − 1 , 0 , 1 ) ( 1 , − 2 , 1 ) (1,-2,1) ( 1 , − 2 , 1 ) 4 ( − 3 , − 1 , 1 , 3 ) (-3,-1,1,3) ( − 3 , − 1 , 1 , 3 ) ( 1 , − 1 , − 1 , 1 ) (1,-1,-1,1) ( 1 , − 1 , − 1 , 1 ) ( − 1 , 3 , − 3 , 1 ) (-1,3,-3,1) ( − 1 , 3 , − 3 , 1 )
Polynomial contrasts describe trends for quantitative levels. They do not imply a meaningful trend among arbitrary category names. Unequal spacing or replication requires coefficients and orthogonality checks appropriate to that design.
A prespecified contrast can be tested directly without first rejecting the global ANOVA. Several planned contrasts still form a testing family when joint error control is intended; planning alone does not eliminate multiplicity.
Multiple Comparisons ¶ With m m m means, all pairwise comparisons form a family of
K = ( m 2 ) = m ( m − 1 ) 2 K=\binom m2=\frac{m(m-1)}2 K = ( 2 m ) = 2 m ( m − 1 ) tests. The family-wise error rate (FWER) is the probability of at least one false rejection in that family.
If K K K null tests were independent and each used level α \alpha α ,
FWER = 1 − ( 1 − α ) K . \operatorname{FWER}=1-(1-\alpha)^K. FWER = 1 − ( 1 − α ) K . With five means, K = 10 K=10 K = 10 and 1 − 0.9 5 10 = 0.4013 1-0.95^{10}=0.4013 1 − 0.9 5 10 = 0.4013 . This is an illustration under independence, not the exact FWER for overlapping pairwise tests, which are dependent.
The one-way pooled pairwise statistic is
t i j = Y ˉ i ⋅ − Y ˉ j ⋅ M S E ( 1 / n i + 1 / n j ) , d f = N − m . t_{ij}=\frac{\bar Y_{i\cdot}-\bar Y_{j\cdot}}
{\sqrt{MSE(1/n_i+1/n_j)}},\qquad df=N-m. t ij = MSE ( 1/ n i + 1/ n j ) Y ˉ i ⋅ − Y ˉ j ⋅ , df = N − m . Procedure Rule Main qualification Fisher’s protected LSD After global rejection, use ordinary pairwise t t t tests. Generally lacks strong FWER control across many groups. Bonferroni Test each of K K K hypotheses at α / K \alpha/K α / K ; adjusted p = min ( 1 , K p ) p=\min(1,Kp) p = min ( 1 , K p ) . Controls FWER without requiring independence; can be conservative. Holm Sort p p p -values; compare p ( j ) p_{(j)} p ( j ) to α / ( K − j + 1 ) \alpha/(K-j+1) α / ( K − j + 1 ) , stopping at the first failure. Strong FWER control without independence; at least as powerful as Bonferroni. Šidák Use α ∗ = 1 − ( 1 − α ) 1 / K \alpha^*=1-(1-\alpha)^{1/K} α ∗ = 1 − ( 1 − α ) 1/ K . Exact family calibration for independent tests; not a universal rule for dependence. Tukey HSD / Tukey-Kramer Use the studentized range distribution for all pairs. Suited to all pairwise mean comparisons under the normal common-variance model.
For Bonferroni two-sided simultaneous intervals,
C ^ ℓ ± t 1 − α / ( 2 K ) , ν SE ( C ^ ℓ ) . \widehat C_\ell\pm t_{1-\alpha/(2K),\nu}\operatorname{SE}(\widehat C_\ell). C ℓ ± t 1 − α / ( 2 K ) , ν SE ( C ℓ ) . For Tukey-Kramer pairwise intervals,
Y ˉ i ⋅ − Y ˉ j ⋅ ± q 1 − α ; m , ν M S E 2 ( 1 n i + 1 n j ) , ν = N − m . \bar Y_{i\cdot}-\bar Y_{j\cdot}\ \pm\
q_{1-\alpha;m,\nu}\sqrt{\frac{MSE}{2}\left(\frac1{n_i}+\frac1{n_j}\right)},\qquad \nu=N-m. Y ˉ i ⋅ − Y ˉ j ⋅ ± q 1 − α ; m , ν 2 MSE ( n i 1 + n j 1 ) , ν = N − m . With equal group size n n n , the margin simplifies to q M S E / n q\sqrt{MSE/n} q MSE / n . Tukey HSD has exact simultaneous coverage under its balanced normal model; Tukey-Kramer extends the procedure to unequal sizes, generally conservatively.
For four hypotheses, suppose sorted p p p -values are 0.004 , 0.013 , 0.030 , 0.200 0.004,0.013,0.030,0.200 0.004 , 0.013 , 0.030 , 0.200 and α = 0.05 \alpha=0.05 α = 0.05 .
Step p ( j ) p_{(j)} p ( j ) Threshold Decision 1 0.004 0.0125 Reject. 2 0.013 0.0167 Reject. 3 0.030 0.0250 Stop; do not reject. 4 0.200 0.0500 Do not reject after stopping.
Bonferroni would reject only the first. The Holm adjusted p p p -values are 0.016 , 0.039 , 0.060 , 0.200 0.016,0.039,0.060,0.200 0.016 , 0.039 , 0.060 , 0.200 .
Define the family before seeing which comparisons look promising. A significant global ANOVA is not permission for unlimited unadjusted follow-up tests.
The cell includes the required ANOVA summaries so it runs independently of the previous page.