Setup
I I I populations with the same variance and different means, Y i j Y_{ij} Y ij , 1 ≤ j ≤ n i 1 \le j \le n_i 1 ≤ j ≤ n i , 1 ≤ i ≤ I 1 \le i \le I 1 ≤ i ≤ I , independent with Y i j ∼ N ( μ i , σ 2 ) Y_{ij} \sim \mathcal{N}(\mu_i, \sigma^2) Y ij ∼ N ( μ i , σ 2 ) . With the common term μ = μ ˉ = 1 I ∑ i = 1 I μ i \mu = \bar{\mu} = \frac{1}{I}\sum_{i=1}^I \mu_i μ = μ ˉ = I 1 ∑ i = 1 I μ i (non-random) and α i = μ i − μ \alpha_i = \mu_i - \mu α i = μ i − μ , ∑ i = 1 I α i = ∑ i μ i − I μ = 0 \sum_{i=1}^I \alpha_i = \sum_i \mu_i - I\mu = 0 ∑ i = 1 I α i = ∑ i μ i − I μ = 0 , so
Y i j ∼ N ( μ + α i , σ 2 ) , Y i j = μ + α i + ε i j , ε i j ∼ N ( 0 , σ 2 ) Y_{ij} \sim \mathcal{N}(\mu + \alpha_i, \sigma^2), \qquad Y_{ij} = \mu + \alpha_i + \varepsilon_{ij}, \quad \varepsilon_{ij} \sim \mathcal{N}(0, \sigma^2) Y ij ∼ N ( μ + α i , σ 2 ) , Y ij = μ + α i + ε ij , ε ij ∼ N ( 0 , σ 2 )
Y ˉ i ⋅ = 1 n i ∑ j = 1 n i Y i j , N = ∑ i = 1 I n i , Y ˉ ⋅ ⋅ = 1 N ∑ i = 1 I ∑ j = 1 n i Y i j = ∑ i = 1 I n i N Y ˉ i ⋅ \bar{Y}_{i\cdot} = \frac{1}{n_i}\sum_{j=1}^{n_i} Y_{ij}, \qquad N = \sum_{i=1}^I n_i, \qquad \bar{Y}_{\cdot\cdot} = \frac{1}{N}\sum_{i=1}^I\sum_{j=1}^{n_i} Y_{ij} = \sum_{i=1}^I \frac{n_i}{N}\bar{Y}_{i\cdot} Y ˉ i ⋅ = n i 1 j = 1 ∑ n i Y ij , N = i = 1 ∑ I n i , Y ˉ ⋅⋅ = N 1 i = 1 ∑ I j = 1 ∑ n i Y ij = i = 1 ∑ I N n i Y ˉ i ⋅
so Y ˉ ⋅ ⋅ \bar{Y}_{\cdot\cdot} Y ˉ ⋅⋅ is a weighted average of the group means, and the plain average 1 I ∑ i Y ˉ i ⋅ \frac{1}{I}\sum_i \bar{Y}_{i\cdot} I 1 ∑ i Y ˉ i ⋅ when all n i = J n_i = J n i = J .
s i 2 = 1 n i − 1 ∑ j = 1 n i ( Y i j − Y ˉ i ⋅ ) 2 , ( n i − 1 ) s i 2 σ 2 ∼ χ n i − 1 2 , ∑ i = 1 I ( n i − 1 ) s i 2 σ 2 ∼ χ N − I 2 s_i^2 = \frac{1}{n_i - 1}\sum_{j=1}^{n_i}(Y_{ij} - \bar{Y}_{i\cdot})^2, \qquad \frac{(n_i - 1)s_i^2}{\sigma^2} \sim \chi^2_{n_i - 1}, \qquad \sum_{i=1}^I \frac{(n_i - 1)s_i^2}{\sigma^2} \sim \chi^2_{N - I} s i 2 = n i − 1 1 j = 1 ∑ n i ( Y ij − Y ˉ i ⋅ ) 2 , σ 2 ( n i − 1 ) s i 2 ∼ χ n i − 1 2 , i = 1 ∑ I σ 2 ( n i − 1 ) s i 2 ∼ χ N − I 2
The overall variability is 1 N − 1 ∑ i ∑ j ( Y i j − Y ˉ ⋅ ⋅ ) 2 \frac{1}{N - 1}\sum_i\sum_j (Y_{ij} - \bar{Y}_{\cdot\cdot})^2 N − 1 1 ∑ i ∑ j ( Y ij − Y ˉ ⋅⋅ ) 2 , and the pooled variance
s p 2 = ∑ i = 1 I ( n i − 1 ) s i 2 ∑ i = 1 I ( n i − 1 ) = ∑ i = 1 I ( n i − 1 ) s i 2 N − I , ( N − I ) s p 2 σ 2 ∼ χ N − I 2 s_p^2 = \frac{\sum_{i=1}^I (n_i - 1)s_i^2}{\sum_{i=1}^I (n_i - 1)} = \frac{\sum_{i=1}^I (n_i - 1)s_i^2}{N - I}, \qquad \frac{(N - I)s_p^2}{\sigma^2} \sim \chi^2_{N - I} s p 2 = ∑ i = 1 I ( n i − 1 ) ∑ i = 1 I ( n i − 1 ) s i 2 = N − I ∑ i = 1 I ( n i − 1 ) s i 2 , σ 2 ( N − I ) s p 2 ∼ χ N − I 2
Two Groups
H 0 : μ 1 = μ 2 H_0 : \mu_1 = \mu_2 H 0 : μ 1 = μ 2 against H A : μ 1 ≠ μ 2 H_A : \mu_1 \neq \mu_2 H A : μ 1 = μ 2 , i.e. H 0 : α i = 0 H_0 : \alpha_i = 0 H 0 : α i = 0 for all i i i . The GLR test rejects for large ∣ T ∣ |T| ∣ T ∣ ,
T = Y ˉ 1 ⋅ − Y ˉ 2 ⋅ s p 2 ( 1 n 1 + 1 n 2 ) ∼ t n 1 + n 2 − 2 under H 0 , T 2 ∼ F 1 , n 1 + n 2 − 2 = F I − 1 , N − I T = \frac{\bar{Y}_{1\cdot} - \bar{Y}_{2\cdot}}{\sqrt{s_p^2\big(\frac{1}{n_1} + \frac{1}{n_2}\big)}} \sim t_{n_1 + n_2 - 2} \text{ under } H_0, \qquad T^2 \sim F_{1, n_1 + n_2 - 2} = F_{I - 1, N - I} T = s p 2 ( n 1 1 + n 2 1 ) Y ˉ 1 ⋅ − Y ˉ 2 ⋅ ∼ t n 1 + n 2 − 2 under H 0 , T 2 ∼ F 1 , n 1 + n 2 − 2 = F I − 1 , N − I
One-Way ANOVA
Let all n i = J n_i = J n i = J , H 0 H_0 H 0 : all means equal.
T S S = ∑ i = 1 I ∑ j = 1 J ( Y i j − Y ˉ ⋅ ⋅ ) 2 , S S W = S S E = ∑ i = 1 I ∑ j = 1 J ( Y i j − Y ˉ i ⋅ ) 2 = ∑ i = 1 I ( J − 1 ) s i 2 , S S B = S S T r = J ∑ i = 1 I ( Y ˉ i ⋅ − Y ˉ ⋅ ⋅ ) 2 TSS = \sum_{i=1}^I\sum_{j=1}^J (Y_{ij} - \bar{Y}_{\cdot\cdot})^2, \qquad SS_W = SSE = \sum_{i=1}^I\sum_{j=1}^J (Y_{ij} - \bar{Y}_{i\cdot})^2 = \sum_{i=1}^I (J - 1)s_i^2, \qquad SS_B = SS_{Tr} = J\sum_{i=1}^I (\bar{Y}_{i\cdot} - \bar{Y}_{\cdot\cdot})^2 TSS = i = 1 ∑ I j = 1 ∑ J ( Y ij − Y ˉ ⋅⋅ ) 2 , S S W = SSE = i = 1 ∑ I j = 1 ∑ J ( Y ij − Y ˉ i ⋅ ) 2 = i = 1 ∑ I ( J − 1 ) s i 2 , S S B = S S T r = J i = 1 ∑ I ( Y ˉ i ⋅ − Y ˉ ⋅⋅ ) 2
the total, within-sample, and between-sample (treatment) sums of squares, with T S S = S S W + S S B TSS = SS_W + SS_B TSS = S S W + S S B and s p 2 = S S W I ( J − 1 ) s_p^2 = \frac{SS_W}{I(J - 1)} s p 2 = I ( J − 1 ) S S W .
S S W σ 2 ∼ χ I ( J − 1 ) 2 \frac{SS_W}{\sigma^2} \sim \chi^2_{I(J - 1)} σ 2 S S W ∼ χ I ( J − 1 ) 2
Under H 0 H_0 H 0 , Y ˉ i ⋅ ∼ N ( μ , σ 2 / J ) \bar{Y}_{i\cdot} \sim \mathcal{N}(\mu, \sigma^2/J) Y ˉ i ⋅ ∼ N ( μ , σ 2 / J ) , so S S B σ 2 ∼ χ I − 1 2 \frac{SS_B}{\sigma^2} \sim \chi^2_{I - 1} σ 2 S S B ∼ χ I − 1 2 , independent of S S W SS_W S S W , and
F = S S B / ( I − 1 ) S S W / ( I ( J − 1 ) ) = M S T r M S E ∼ F I − 1 , I ( J − 1 ) F = \frac{SS_B / (I - 1)}{SS_W / (I(J - 1))} = \frac{MS_{Tr}}{MS_E} \sim F_{I - 1, I(J - 1)} F = S S W / ( I ( J − 1 )) S S B / ( I − 1 ) = M S E M S T r ∼ F I − 1 , I ( J − 1 )
Reject for large F F F ; the p-value is P ( F I − 1 , I ( J − 1 ) > F o b s ) P(F_{I-1, I(J-1)} > F_{obs}) P ( F I − 1 , I ( J − 1 ) > F o b s ) , and H 0 H_0 H 0 is rejected if it is less than α \alpha α . For independent X i ∼ N ( μ i , σ 2 ) X_i \sim \mathcal{N}(\mu_i, \sigma^2) X i ∼ N ( μ i , σ 2 ) , E [ ( X i − X ˉ ) 2 ] = ( μ i − μ ˉ ) 2 + n − 1 n σ 2 E[(X_i - \bar{X})^2] = (\mu_i - \bar{\mu})^2 + \frac{n - 1}{n}\sigma^2 E [( X i − X ˉ ) 2 ] = ( μ i − μ ˉ ) 2 + n n − 1 σ 2 .
Source Sum of squares df Mean square F Between S S T r ( S S B ) I − 1 M S T r = S S T r I − 1 M S T r M S E Within S S E ( S S W ) I ( J − 1 ) M S E = S S E I ( J − 1 ) Total T S S I J − 1 \begin{array}{l|l|l|l|l}
\text{Source} & \text{Sum of squares} & \text{df} & \text{Mean square} & F \\
\hline
\text{Between} & SS_{Tr} \; (SS_B) & I - 1 & MS_{Tr} = \frac{SS_{Tr}}{I - 1} & \frac{MS_{Tr}}{MS_E} \\
\text{Within} & SSE \; (SS_W) & I(J - 1) & MS_E = \frac{SSE}{I(J - 1)} & \\
\text{Total} & TSS & IJ - 1 & &
\end{array} Source Between Within Total Sum of squares S S T r ( S S B ) SSE ( S S W ) TSS df I − 1 I ( J − 1 ) I J − 1 Mean square M S T r = I − 1 S S T r M S E = I ( J − 1 ) SSE F M S E M S T r
Two-Way ANOVA
Y i j k Y_{ijk} Y ijk is the k k k -th of K K K replicates with factor A at level i i i and factor B at level j j j .
Source Sum of squares df A S S A I − 1 B S S B J − 1 Interaction S S A B ( I − 1 ) ( J − 1 ) Error S S E I J ( K − 1 ) Total T S S I J K − 1 \begin{array}{l|l|l}
\text{Source} & \text{Sum of squares} & \text{df} \\
\hline
\text{A} & SS_A & I - 1 \\
\text{B} & SS_B & J - 1 \\
\text{Interaction} & SS_{AB} & (I - 1)(J - 1) \\
\text{Error} & SSE & IJ(K - 1) \\
\text{Total} & TSS & IJK - 1
\end{array} Source A B Interaction Error Total Sum of squares S S A S S B S S A B SSE TSS df I − 1 J − 1 ( I − 1 ) ( J − 1 ) I J ( K − 1 ) I J K − 1
Simple Linear Regression
Y = β x + a + ϵ Y = \beta x + a + \epsilon Y = β x + a + ϵ , ϵ ∼ N ( 0 , σ 2 ) \epsilon \sim \mathcal{N}(0, \sigma^2) ϵ ∼ N ( 0 , σ 2 ) . Estimate y ^ = β ^ x + a ^ \hat{y} = \hat{\beta}x + \hat{a} y ^ = β ^ x + a ^ by minimizing the squared error ∑ i = 1 n [ y i − ( β x i + a ) ] 2 \sum_{i=1}^n [y_i - (\beta x_i + a)]^2 ∑ i = 1 n [ y i − ( β x i + a ) ] 2 ,
β ^ = ∑ i = 1 n ( x i − x ˉ ) ( y i − y ˉ ) ∑ i = 1 n ( x i − x ˉ ) 2 = S x y S x x , a ^ = y ˉ − β ^ x ˉ \hat{\beta} = \frac{\sum_{i=1}^n (x_i - \bar{x})(y_i - \bar{y})}{\sum_{i=1}^n (x_i - \bar{x})^2} = \frac{S_{xy}}{S_{xx}}, \qquad \hat{a} = \bar{y} - \hat{\beta}\bar{x} β ^ = ∑ i = 1 n ( x i − x ˉ ) 2 ∑ i = 1 n ( x i − x ˉ ) ( y i − y ˉ ) = S xx S x y , a ^ = y ˉ − β ^ x ˉ
with S x x = ∑ ( x i − x ˉ ) 2 S_{xx} = \sum (x_i - \bar{x})^2 S xx = ∑ ( x i − x ˉ ) 2 , S x y = ∑ ( x i − x ˉ ) ( y i − y ˉ ) S_{xy} = \sum (x_i - \bar{x})(y_i - \bar{y}) S x y = ∑ ( x i − x ˉ ) ( y i − y ˉ ) , and
T S S = S y y = ∑ i = 1 n ( y i − y ˉ ) 2 = ∑ i = 1 n ( y i − y ^ i ) 2 ⏟ S S E + ∑ i = 1 n ( y ^ i − y ˉ ) 2 ⏟ S S R TSS = S_{yy} = \sum_{i=1}^n (y_i - \bar{y})^2 = \underbrace{\sum_{i=1}^n (y_i - \hat{y}_i)^2}_{SSE} + \underbrace{\sum_{i=1}^n (\hat{y}_i - \bar{y})^2}_{SSR} TSS = S yy = i = 1 ∑ n ( y i − y ˉ ) 2 = SSE i = 1 ∑ n ( y i − y ^ i ) 2 + SSR i = 1 ∑ n ( y ^ i − y ˉ ) 2
M S E = S S E n − 2 , E [ M S E ] = σ 2 , V a r ( M S E ) = σ 4 ( n − 2 ) / 2 MSE = \frac{SSE}{n - 2}, \qquad E[MSE] = \sigma^2, \qquad \mathrm{Var}(MSE) = \frac{\sigma^4}{(n - 2)/2} MSE = n − 2 SSE , E [ MSE ] = σ 2 , Var ( MSE ) = ( n − 2 ) /2 σ 4