19  Chapter 18: Analysis of Variance I — One-Way ANOVA

This chapter introduces one-way analysis of variance (ANOVA). The goal is to compare more than two normal population means while controlling the overall Type I error rate. We start from the pooled two-sample \(t\)-test, introduce the cell-means ANOVA model, study contrasts, and derive the classical ANOVA \(F\)-test and ANOVA table.

NoteTopics

Pooled two-sample \(t\)-test; one-way ANOVA model assumptions; global ANOVA hypothesis; treatment effects; identifiability; linear combinations and contrasts; inference for contrasts; sums of squares; ANOVA decomposition; chi-square theory; ANOVA \(F\)-test; one-way ANOVA table.

20 Overview

This section explains how ANOVA extends the two-sample pooled \(t\)-test to compare several treatment means at once.

The main topics are:

  1. review of the pooled two-sample \(t\)-test;

  2. one-way ANOVA model assumptions;

  3. the classical ANOVA hypothesis;

  4. linear combinations and contrasts;

  5. inference for contrasts;

  6. the ANOVA \(F\)-test;

  7. the one-way ANOVA table.

TipKey idea

Main idea. ANOVA compares variation between group means with variation within groups. If the between-group variation is large relative to the within-group variation, then the data provide evidence that not all group means are equal.

21 Review: Two Independent Samples and the Pooled \(t\)-Test

This section reviews the two-sample method that ANOVA generalizes.

21.1 Two independent normal samples

Suppose we observe two independent samples \[X_1,\ldots,X_n \sim \operatorname{Normal}(\mu_X,\sigma^2), \qquad Y_1,\ldots,Y_m \sim \operatorname{Normal}(\mu_Y,\sigma^2),\] where the two population variances are assumed equal but unknown. The classical pooled \(t\)-test tests \[H_0: \mu_X=\mu_Y \qquad \text{versus} \qquad H_1: \mu_X \neq \mu_Y,\] or one-sided alternatives such as \(H_1: \mu_X>\mu_Y\).

NoteDefinition

Definition 1 (Pooled variance estimator). The pooled variance estimator is \[S_p^2 =\frac{(n-1)S_X^2+(m-1)S_Y^2}{n+m-2},\] where \[S_X^2=\frac{1}{n-1}\sum_{i=1}^n (X_i-\bar X)^2, \qquad S_Y^2=\frac{1}{m-1}\sum_{j=1}^m (Y_j-\bar Y)^2.\]

ImportantTheorem

Theorem 2 (Pooled \(t\)-statistic). Under \(H_0:\mu_X=\mu_Y\), the statistic \[T =\frac{\bar X-\bar Y}{S_p\sqrt{\frac{1}{n}+\frac{1}{m}}}\] has a Student \(t\) distribution with \(n+m-2\) degrees of freedom: \[T\sim t_{n+m-2}.\]

21.2 Rejection rules

The rejection rule depends on the alternative hypothesis.

Alternative Rejection region Interpretation
\(H_1:\mu_X>\mu_Y\) \(T\geq t_{n+m-2,\alpha}\) right-tailed test
\(H_1:\mu_X<\mu_Y\) \(T\leq -t_{n+m-2,\alpha}\) left-tailed test
\(H_1:\mu_X\neq \mu_Y\) \(|T|\geq t_{n+m-2,\alpha/2}\) two-tailed test
NoteRemark

Remark 3. The pooled \(t\)-test is a test for the difference between two means. One-way ANOVA asks the corresponding question for \(k\) independent groups: are all \(k\) population means equal?

TipExample

Example 4 (Pooled \(t\)-test as a special case of ANOVA). Suppose there are only two treatment groups. Then one-way ANOVA compares \(\theta_1\) and \(\theta_2\). The ANOVA null hypothesis \[H_0:\theta_1=\theta_2\] is exactly the same null hypothesis as the two-sample pooled \(t\)-test.

CautionSolution

When \(k=2\), the between-group variation has only one degree of freedom. The one-way ANOVA \(F\) statistic satisfies \[F=T^2,\] where \(T\) is the pooled two-sample \(t\) statistic. Therefore, for two groups, the ANOVA \(F\)-test and the two-sided pooled \(t\)-test lead to the same conclusion.

22 The One-Way ANOVA Cell-Means Model

This section introduces the statistical model used for one-way ANOVA.

22.1 Model notation

Suppose there are \(k\) groups or treatments. In group \(i\), we observe \[Y_{i1},Y_{i2},\ldots,Y_{i n_i}, \qquad i=1,\ldots,k.\] The one-way ANOVA cell-means model is \[Y_{ij}=\theta_i+\varepsilon_{ij}, \qquad i=1,\ldots,k, \qquad j=1,\ldots,n_i.\] Here:

  • \(i\) is the group or treatment index;

  • \(j\) is the observation index within group \(i\);

  • \(\theta_i\) is the mean of group \(i\);

  • \(\varepsilon_{ij}\) is the random error or noise term.

NoteDefinition

Definition 5 (One-way ANOVA model). The one-way ANOVA model assumes that \[Y_{ij}\sim \operatorname{Normal}(\theta_i,\sigma^2),\] independently across all \(i\) and \(j\). Equivalently, \[\varepsilon_{ij}\sim \operatorname{Normal}(0,\sigma^2)\] independently.

22.2 Model assumptions

One-way ANOVA depends on three core assumptions.

TipKey idea

One-way ANOVA assumptions. For the model \(Y_{ij}=\theta_i+\varepsilon_{ij}\), assume:

  1. \(\mathbb{E}(\varepsilon_{ij})=0\) and \(\operatorname{Var}(\varepsilon_{ij})=\sigma^2<\infty\);

  2. the errors are independent and normally distributed;

  3. the groups have equal variance: \(\sigma_i^2=\sigma^2\) for all \(i=1,\ldots,k\).

NoteRemark

Remark 6. The equal-variance assumption is the same assumption used by the pooled two-sample \(t\)-test. ANOVA pools the within-group variation across all \(k\) groups to estimate the common error variance \(\sigma^2\).

22.3 Dot notation

This subsection introduces the compact dot notation used throughout ANOVA.

Let \[N=\sum_{i=1}^k n_i\] be the total sample size.

NoteDefinition

Definition 7 (Group totals, group means, and grand mean). The group total for group \(i\) is \[T_{i\cdot}=\sum_{j=1}^{n_i} Y_{ij}.\] The group mean is \[\bar Y_{i\cdot}=\frac{T_{i\cdot}}{n_i} =\frac{1}{n_i}\sum_{j=1}^{n_i}Y_{ij}.\] The overall total is \[T_{\cdot\cdot}=\sum_{i=1}^k\sum_{j=1}^{n_i}Y_{ij} =\sum_{i=1}^k T_{i\cdot}.\] The grand mean is \[\bar Y_{\cdot\cdot} =\frac{1}{N}\sum_{i=1}^k\sum_{j=1}^{n_i}Y_{ij} =\frac{1}{N}\sum_{i=1}^k T_{i\cdot} =\frac{1}{N}\sum_{i=1}^k n_i\bar Y_{i\cdot}.\]

NoteRemark

Remark 8. A dot in a subscript means that we sum or average over that index. Thus \(T_{i\cdot}\) sums over \(j\), while \(T_{\cdot\cdot}\) sums over both \(i\) and \(j\).

23 Example: Liver Deterioration Data

This section works through the toxin example from the lecture notes and computes the descriptive summaries and ANOVA table.

23.1 Data table

The data record liver deterioration measurements for four groups: Control, Toxin 1, Toxin 2, and Toxin 3.

Toxin 1 Toxin 2 Toxin 3 Control
28 33 18 11
23 36 21 14
14 34 20 11
27 29 22 16
31 24
34

The group descriptive statistics are:

Group \(n_i\) \(\bar y_{i\cdot}\) \(s_i^2\) \(s_i\)
Control 4 13.000 6.000 2.449
Toxin 1 4 23.000 40.667 6.377
Toxin 2 6 32.833 6.167 2.483
Toxin 3 5 21.000 5.000 2.236
TipExample

Example 9 (Interpreting the group means). Based on the group means, which group appears to have the largest liver deterioration?

CautionSolution

The group means are \[\bar y_{\text{Control}}=13.000, \quad \bar y_{\text{Toxin 1}}=23.000, \quad \bar y_{\text{Toxin 2}}=32.833, \quad \bar y_{\text{Toxin 3}}=21.000.\] The largest sample mean is for Toxin 2. This suggests that Toxin 2 may produce the highest average deterioration, but ANOVA is needed to decide whether the differences are statistically significant relative to within-group variability.

23.2 Boxplot interpretation

The lecture notes include a boxplot showing that the Control group is clearly lower than the toxin groups and that Toxin 2 is the highest group. The boxplot is useful because it displays both location and within-group spread.

24 Overparameterized Treatment-Effect Model

This section explains an alternative but non-identifiable way to write the same one-way ANOVA model.

24.1 Grand mean plus treatment effects

Instead of writing \[Y_{ij}=\theta_i+\varepsilon_{ij},\] one can write \[Y_{ij}=\mu+\tau_i+\varepsilon_{ij},\] where:

  • \(\mu\) is a grand mean or common baseline;

  • \(\tau_i\) is the treatment effect for group \(i\);

  • \(\varepsilon_{ij}\) is the random error.

24.2 Non-identifiability

The model \[Y_{ij}=\mu+\tau_i+\varepsilon_{ij}\] is overparameterized unless we impose a constraint. Indeed, for any constant \(c\), \[\mu'=\mu+c, \qquad \tau_i'=\tau_i-c\] gives the same fitted mean because \[\mu'+\tau_i'=(\mu+c)+(\tau_i-c)=\mu+\tau_i.\] Thus, \(\mu\) and the \(\tau_i\)’s are not uniquely determined.

NoteDefinition

Definition 10 (Identifiability). A parameter is identifiable if different parameter values lead to different probability distributions for the observed data.

TipKey idea

Common identifiability constraint. A standard way to identify the treatment-effect model is to impose \[\sum_{i=1}^k \tau_i=0.\] Under this constraint, \(\mu\) represents the average treatment mean and \(\tau_i\) represents the deviation of group \(i\) from that average.

25 The Classical ANOVA Hypothesis

This section states the global null hypothesis tested by one-way ANOVA.

NoteDefinition

Definition 11 (Classical one-way ANOVA hypothesis). The classical ANOVA null hypothesis is \[H_0:\theta_1=\theta_2=\cdots=\theta_k.\] The alternative hypothesis is \[H_1:\theta_i\neq \theta_j \quad \text{for some } i,j.\]

NoteRemark

Remark 12. Rejecting \(H_0\) does not mean that all means are different. It only means that at least two treatment means differ. After rejecting the global ANOVA null, follow-up comparisons or contrasts are needed to determine which means differ and how they differ.

TipExample

Example 13 (Agricultural ANOVA hypothesis). A study investigates the effect of fertilizer mixtures on the zinc content of spinach plants. The treatments are:

Treatment Magnesium Potassium Zinc
1 0 0 0
2 0 200 0
3 50 200 0
4 200 200 0
5 0 200 15

The global ANOVA hypothesis is \[H_0:\theta_1=\theta_2=\theta_3=\theta_4=\theta_5.\]

CautionSolution

Here \(\theta_i\) is the mean zinc content under fertilizer treatment \(i\). The null hypothesis says that all five fertilizer mixtures have the same mean effect. The scientific question is usually not merely whether the means are equal, but how the treatments compare. For example, one may compare treatment 1 with treatment 2, or compare zinc-added treatment 5 with potassium-only treatment 2.

26 Linear Combinations and Contrasts

This section introduces contrasts, which are the most useful way to ask meaningful comparison questions in ANOVA.

26.1 Linear combinations

Given numbers or parameters \[t=(t_1,\ldots,t_k)\] and constants \[a=(a_1,\ldots,a_k),\] a linear combination is \[\sum_{i=1}^k a_i t_i.\]

NoteDefinition

Definition 14 (Contrast). A linear combination \[\sum_{i=1}^k a_i t_i\] is called a contrast if \[\sum_{i=1}^k a_i=0.\]

TipExample

Example 15 (Basic contrasts). Common contrasts include:

  1. Comparing one treatment with a control: \[\theta_{\text{Toxin}}-\theta_{\text{Control}}.\] This corresponds to coefficients \((1,-1)\) for the treatment and control.

  2. Comparing the average of two treatments with a control: \[\frac{1}{2}(\theta_{T1}+\theta_{T2})-\theta_C.\] The coefficients are \(1/2,1/2,-1\), whose sum is zero.

CautionSolution

Both examples are contrasts because the coefficients add to zero. Contrasts are meaningful because they compare means rather than depending on the arbitrary zero point of the measurement scale.

26.2 ANOVA null as all contrasts equal zero

The ANOVA null hypothesis can be expressed using contrasts.

ImportantTheorem

Theorem 16 (ANOVA null and contrasts). The null hypothesis \[H_0:\theta_1=\theta_2=\cdots=\theta_k\] is equivalent to the statement that every contrast is zero: \[\sum_{i=1}^k a_i\theta_i=0 \qquad \text{for every } a=(a_1,\ldots,a_k) \text{ satisfying } \sum_{i=1}^k a_i=0.\]

NoteProof

Proof. If \(\theta_1=\cdots=\theta_k=\theta\), then for any contrast vector \(a\), \[\sum_{i=1}^k a_i\theta_i =\theta\sum_{i=1}^k a_i =0.\] Conversely, suppose every contrast is zero. Choose the contrast vector with \(a_i=1\), \(a_j=-1\), and all other entries zero. Then \[\theta_i-\theta_j=0.\] Since this holds for every pair \(i,j\), all \(\theta_i\) are equal. ◻

TipKey idea

Why contrasts matter. The global ANOVA test tells us whether some difference exists. Contrasts tell us which scientific comparison is being made: treatment versus control, one treatment versus another, or one group of treatments versus another group.

27 Inference for Linear Combinations of Means

This section derives tests and confidence intervals for general linear combinations and contrasts.

27.1 Distribution of group means

Under the one-way ANOVA model, \[Y_{ij}\sim \operatorname{Normal}(\theta_i,\sigma^2),\] so each group sample mean satisfies \[\bar Y_{i\cdot} =\frac{1}{n_i}\sum_{j=1}^{n_i}Y_{ij} \sim \operatorname{Normal}\left(\theta_i,\frac{\sigma^2}{n_i}\right).\] For a linear combination \[\widehat L=\sum_{i=1}^k a_i\bar Y_{i\cdot},\] we have \[\mathbb{E}(\widehat L)=\sum_{i=1}^k a_i\theta_i\] and, by independence across groups, \[\operatorname{Var}(\widehat L)=\sigma^2\sum_{i=1}^k \frac{a_i^2}{n_i}.\]

ImportantTheorem

Theorem 17 (Known-variance standardized statistic). If \(\sigma^2\) is known, then \[Z =\frac{\sum_{i=1}^k a_i\bar Y_{i\cdot}-\sum_{i=1}^k a_i\theta_i} {\sigma\sqrt{\sum_{i=1}^k a_i^2/n_i}} \sim \operatorname{Normal}(0,1).\]

27.2 Pooled ANOVA estimate of \(\sigma^2\)

In practice, \(\sigma^2\) is unknown. ANOVA estimates it using pooled within-group variation: \[S_p^2 =\frac{1}{N-k}\sum_{i=1}^k\sum_{j=1}^{n_i}(Y_{ij}-\bar Y_{i\cdot})^2.\] This is also called the mean squared error: \[\mathrm{MSE}=S_p^2.\] Under the normal ANOVA model, \[\frac{(N-k)S_p^2}{\sigma^2}\sim \chi^2_{N-k}.\]

ImportantTheorem

Theorem 18 (Contrast \(t\)-statistic). For a contrast or linear combination \[L=\sum_{i=1}^k a_i\theta_i, \qquad \widehat L=\sum_{i=1}^k a_i\bar Y_{i\cdot},\] the statistic \[T =\frac{\widehat L-L}{S_p\sqrt{\sum_{i=1}^k a_i^2/n_i}}\] has a Student \(t\) distribution with \(N-k\) degrees of freedom: \[T\sim t_{N-k}.\]

27.3 Testing a contrast

To test \[H_0:\sum_{i=1}^k a_i\theta_i=0 \qquad \text{versus} \qquad H_1:\sum_{i=1}^k a_i\theta_i\neq 0,\] use the statistic \[T =\frac{\sum_{i=1}^k a_i\bar Y_{i\cdot}} {S_p\sqrt{\sum_{i=1}^k a_i^2/n_i}}.\] At level \(\alpha\), reject \(H_0\) if \[|T|>t_{N-k,\alpha/2}.\]

27.4 Confidence interval for a contrast

A \(100(1-\alpha)\%\) confidence interval for the contrast \[L=\sum_{i=1}^k a_i\theta_i\] is \[\sum_{i=1}^k a_i\bar Y_{i\cdot} \pm t_{N-k,\alpha/2} S_p\sqrt{\sum_{i=1}^k\frac{a_i^2}{n_i}}.\]

TipExample

Example 19 (Comparing two treatments directly). To compare treatment 1 with treatment 2, use the contrast vector \[a=(1,-1,0,\ldots,0).\] Then \[L=\theta_1-\theta_2, \qquad \widehat L=\bar Y_{1\cdot}-\bar Y_{2\cdot}.\] The test statistic is \[T=\frac{\bar Y_{1\cdot}-\bar Y_{2\cdot}} {S_p\sqrt{\frac{1}{n_1}+\frac{1}{n_2}}}.\]

CautionSolution

The coefficient vector sums to \(1-1+0+\cdots+0=0\), so it is a contrast. The statistic has a \(t_{N-k}\) distribution under \(H_0:\theta_1=\theta_2\). This resembles the two-sample pooled \(t\)-test, but \(S_p^2\) is estimated using all groups, not only groups 1 and 2.

TipExample

Example 20 (Control versus average of two treatments). Suppose treatment 1 is a control and treatments 2 and 3 are experimental. To compare the control with the average of treatments 2 and 3, use \[a=\left(1,-\frac12,-\frac12,0,\ldots,0\right).\] Then \[L=\theta_1-\frac12(\theta_2+\theta_3),\] and \[\widehat L=\bar Y_{1\cdot}-\frac12(\bar Y_{2\cdot}+\bar Y_{3\cdot}).\]

CautionSolution

The standard error is \[S_p\sqrt{\frac{1}{n_1}+\frac{1}{4n_2}+\frac{1}{4n_3}}.\] Thus the statistic for testing \[H_0:\theta_1=\frac12(\theta_2+\theta_3)\] is \[T= \frac{\bar Y_{1\cdot}-\frac12(\bar Y_{2\cdot}+\bar Y_{3\cdot})} {S_p\sqrt{\frac{1}{n_1}+\frac{1}{4n_2}+\frac{1}{4n_3}}}.\] Reject \(H_0\) for large \(|T|\).

WarningImportant correction

Sign correction For the contrast “control versus the average of treatments 2 and 3,” the natural contrast is \[\bar Y_{1\cdot}-\frac12(\bar Y_{2\cdot}+\bar Y_{3\cdot}),\] not \(\bar Y_{1\cdot}-\frac12(\bar Y_{2\cdot}-\bar Y_{3\cdot})\).

28 Why Not Use Many Pairwise \(t\)-Tests?

This section explains why ANOVA uses one global \(F\)-test instead of many separate \(t\)-tests.

The classical ANOVA null hypothesis is \[H_0:\theta_1=\theta_2=\cdots=\theta_k.\] One could try testing many pairwise hypotheses: \[H_0:\theta_i=\theta_j \qquad \text{versus} \qquad H_1:\theta_i\neq \theta_j.\] However, running many separate tests inflates the probability of at least one false positive.

TipExample

Example 21 (Inflation of Type I error). Suppose each individual test has Type I error probability \(0.05\) and the tests are independent. With two tests, the probability of at least one Type I error is \[1-(1-0.05)^2=1-0.95^2\approx 0.0975.\] With three tests, the probability is \[1-0.95^3\approx 0.143.\]

CautionSolution

Each test has a \(95\%\) chance of making no Type I error. If tests are independent, the chance that all tests avoid Type I error is \(0.95^r\) for \(r\) tests. Therefore, the chance of at least one Type I error is \(1-0.95^r\). This increases as \(r\) increases.

TipKey idea

ANOVA advantage. The ANOVA \(F\)-test provides a single global test of equal means while controlling the Type I error rate at the desired level \(\alpha\).

29 Union–Intersection View of the ANOVA \(F\)-Test

This section connects the ANOVA \(F\)-test with the contrast-based view of the null hypothesis.

Let \[\mathcal A=\left\{a=(a_1,\ldots,a_k):\sum_{i=1}^k a_i=0\right\}\] be the set of all contrast vectors. The ANOVA null can be written as \[H_0:\sum_{i=1}^k a_i\theta_i=0 \quad \text{for all } a\in\mathcal A.\] The alternative is \[H_1:\sum_{i=1}^k a_i\theta_i\neq 0 \quad \text{for some } a\in\mathcal A.\] For each contrast \(a\), define \[\Theta_a=\left\{\theta:\sum_{i=1}^k a_i\theta_i=0\right\}.\] Then the ANOVA null is the intersection \[H_0:\theta\in\bigcap_{a\in\mathcal A}\Theta_a.\]

For each contrast, the natural test statistic is \[T_a =\frac{\left|\sum_{i=1}^k a_i\bar Y_{i\cdot}\right|} {S_p\sqrt{\sum_{i=1}^k a_i^2/n_i}}.\] The union–intersection principle rejects the global null if some contrast gives strong evidence against zero: \[\sup_{a\in\mathcal A}T_a>c.\] This maximization leads to the classical ANOVA \(F\) statistic.

30 Sums of Squares in One-Way ANOVA

This section defines the three key sums of squares: between-group, within-group, and total.

30.1 Definitions

The total variability around the grand mean is decomposed into between-group and within-group parts.

NoteDefinition

Definition 22 (ANOVA sums of squares). The between-treatment sum of squares is \[\mathrm{SSB} =\sum_{i=1}^k n_i(\bar Y_{i\cdot}-\bar Y_{\cdot\cdot})^2.\] The error or within-treatment sum of squares is \[\mathrm{SSE} =\sum_{i=1}^k\sum_{j=1}^{n_i}(Y_{ij}-\bar Y_{i\cdot})^2.\] The total sum of squares is \[\mathrm{SST} =\sum_{i=1}^k\sum_{j=1}^{n_i}(Y_{ij}-\bar Y_{\cdot\cdot})^2.\]

ImportantTheorem

Theorem 23 (Partitioning sums of squares). The total sum of squares decomposes as \[\mathrm{SST}=\mathrm{SSB}+\mathrm{SSE}.\]

NoteProof

Proof. Write \[Y_{ij}-\bar Y_{\cdot\cdot} =(Y_{ij}-\bar Y_{i\cdot})+(\bar Y_{i\cdot}-\bar Y_{\cdot\cdot}).\] Squaring and summing gives \[\begin{aligned} \mathrm{SST} &=\sum_{i=1}^k\sum_{j=1}^{n_i}(Y_{ij}-\bar Y_{i\cdot})^2 +\sum_{i=1}^k\sum_{j=1}^{n_i}(\bar Y_{i\cdot}-\bar Y_{\cdot\cdot})^2 \\ &\qquad +2\sum_{i=1}^k(\bar Y_{i\cdot}-\bar Y_{\cdot\cdot})\sum_{j=1}^{n_i}(Y_{ij}-\bar Y_{i\cdot}). \end{aligned}\] The cross term is zero because \[\sum_{j=1}^{n_i}(Y_{ij}-\bar Y_{i\cdot})=0\] for each group. Therefore, \[\mathrm{SST}=\mathrm{SSE}+\mathrm{SSB}.\] ◻

30.2 Mean squares

Define the mean squares \[\mathrm{MSB}=\frac{\mathrm{SSB}}{k-1}, \qquad \mathrm{MSE}=\frac{\mathrm{SSE}}{N-k}.\] The within-group mean square is also the pooled ANOVA variance estimate: \[\mathrm{MSE}=S_p^2.\]

31 Chi-Square Distributions and the ANOVA \(F\)-Statistic

This section gives the distributional theory behind the ANOVA \(F\)-test.

ImportantTheorem

Theorem 24 (Chi-square distributions of sums of squares). Under the ANOVA assumptions, \[\frac{\mathrm{SSE}}{\sigma^2}\sim \chi^2_{N-k}.\] If the null hypothesis \[H_0:\theta_1=\theta_2=\cdots=\theta_k\] is true, then \[\frac{\mathrm{SSB}}{\sigma^2}\sim \chi^2_{k-1}.\] Also, \[\frac{\mathrm{SST}}{\sigma^2}\sim \chi^2_{N-1}\] under the null. Moreover, under the normal ANOVA model, \(\mathrm{SSB}\) and \(\mathrm{SSE}\) are independent.

ImportantTheorem

Theorem 25 (ANOVA \(F\) statistic). If \[H_0:\theta_1=\theta_2=\cdots=\theta_k\] is true, then \[F =\frac{\mathrm{SSB}/(k-1)}{\mathrm{SSE}/(N-k)} =\frac{\mathrm{MSB}}{\mathrm{MSE}}\] has an \(F\) distribution with \(k-1\) and \(N-k\) degrees of freedom: \[F\sim F_{k-1,N-k}.\]

NoteRemark

Remark 26. The ANOVA \(F\) statistic compares between-group variation with within-group variation. Large values of \(F\) indicate that group means are spread out more than expected from random within-group error alone.

31.1 Rejection rule and p-value

For an \(\alpha\) level one-way ANOVA test, reject \[H_0:\theta_1=\cdots=\theta_k\] if \[F_{\mathrm{obs}}>F_{k-1,N-k,\alpha},\] where \(F_{k-1,N-k,\alpha}\) is the upper \(\alpha\) critical value of the \(F_{k-1,N-k}\) distribution.

The p-value is \[p\text{-value}=\mathbb{P}\left(F_{k-1,N-k}\geq F_{\mathrm{obs}}\right).\]

32 One-Way ANOVA Table

This section summarizes the ANOVA calculations in the standard table format.

Source of Variation Sum of Squares Degrees of Freedom Mean Square \(F\) Statistic
Between Groups \(\mathrm{SSB}\) \(k-1\) \(\mathrm{MSB}=\dfrac{\mathrm{SSB}}{k-1}\) \(\dfrac{\mathrm{MSB}}{\mathrm{MSE}}\)
Within Groups / Error \(\mathrm{SSE}\) \(N-k\) \(\mathrm{MSE}=\dfrac{\mathrm{SSE}}{N-k}\)
Total \(\mathrm{SST}\) \(N-1\)
TipKey idea

How to read an ANOVA table. The ANOVA table separates total variation into two parts:

  • variation explained by group membership, measured by \(\mathrm{SSB}\);

  • unexplained within-group variation, measured by \(\mathrm{SSE}\).

The ratio \(F=\mathrm{MSB}/\mathrm{MSE}\) is large when group means are far apart relative to within-group noise.

33 Worked ANOVA Example

This section completes the liver deterioration example using the ANOVA sums of squares and \(F\)-test.

TipExample

Example 27 (ANOVA table for the toxin data). Using the liver deterioration data, test whether the four group means are equal.

CautionSolution

There are \(k=4\) groups and total sample size \[N=4+4+6+5=19.\] The group means are \[13.000, \quad 23.000, \quad 32.833, \quad 21.000.\] The grand mean is \[\bar y_{\cdot\cdot}=23.474.\] The sums of squares are \[\mathrm{SSB}=995.904, \qquad \mathrm{SSE}=190.833, \qquad \mathrm{SST}=1186.737.\] The degrees of freedom are \[\mathrm{df}_{\text{between}}=k-1=3, \qquad \mathrm{df}_{\text{error}}=N-k=15, \qquad \mathrm{df}_{\text{total}}=N-1=18.\] Thus \[\mathrm{MSB}=\frac{995.904}{3}=331.968, \qquad \mathrm{MSE}=\frac{190.833}{15}=12.722.\] The observed \(F\) statistic is \[F_{\mathrm{obs}} =\frac{331.968}{12.722} =26.094.\] The ANOVA table is:

Source SS df MS \(F\)
Between groups 995.904 3 331.968 26.094
Within groups / Error 190.833 15 12.722
Total 1186.737 18

The p-value is approximately \[p\approx 3.35\times 10^{-6}.\] This is very small, so we reject the null hypothesis that all four group means are equal. There is strong evidence that at least two treatment means differ.

NoteRemark

Remark 28. The ANOVA test tells us that some difference exists among the treatment means, but it does not identify which treatment pairs differ. To answer that question, one should use contrasts or multiple-comparison procedures.

34 Practice Problems

This section gives practice questions that reinforce the main computations and interpretations.

WarningPractice Problem

Practice Problem 29 (Dot notation). Suppose there are three groups with observations \[(4,6,5),\qquad (8,9),\qquad (3,4,5,6).\] Compute \(T_{i\cdot}\), \(\bar Y_{i\cdot}\), \(T_{\cdot\cdot}\), and \(\bar Y_{\cdot\cdot}\).

CautionSolution

The group totals are \[T_{1\cdot}=4+6+5=15, \qquad T_{2\cdot}=8+9=17, \qquad T_{3\cdot}=3+4+5+6=18.\] The group sample sizes are \(n_1=3,n_2=2,n_3=4\), so \[\bar Y_{1\cdot}=5, \qquad \bar Y_{2\cdot}=8.5, \qquad \bar Y_{3\cdot}=4.5.\] The total is \[T_{\cdot\cdot}=15+17+18=50,\] and \(N=3+2+4=9\), so \[\bar Y_{\cdot\cdot}=\frac{50}{9}=5.556.\]

WarningPractice Problem

Practice Problem 30 (Identifying contrasts). For four treatment means \(\theta_1,\theta_2,\theta_3,\theta_4\), determine which of the following coefficient vectors define contrasts: \[a=(1,-1,0,0), \qquad b=\left(1,-\frac12,-\frac12,0\right), \qquad c=(1,1,0,0).\]

CautionSolution

A vector defines a contrast if its coefficients sum to zero. \[1-1+0+0=0,\] so \(a\) is a contrast. \[1-\frac12-\frac12+0=0,\] so \(b\) is a contrast. \[1+1+0+0=2\neq 0,\] so \(c\) is not a contrast.

WarningPractice Problem

Practice Problem 31 (Contrast standard error). Suppose \(k=3\), \(n_1=5,n_2=5,n_3=10\), and \(S_p^2=4\). Find the standard error of \[\widehat L=\bar Y_{1\cdot}-\frac12\bar Y_{2\cdot}-\frac12\bar Y_{3\cdot}.\]

CautionSolution

The coefficients are \[a_1=1, \qquad a_2=-\frac12, \qquad a_3=-\frac12.\] The standard error is \[S_p\sqrt{\sum_{i=1}^3\frac{a_i^2}{n_i}}.\] Since \(S_p=\sqrt{4}=2\), \[\begin{aligned} \operatorname{se}(\widehat L) &=2\sqrt{\frac{1^2}{5}+\frac{(1/2)^2}{5}+\frac{(1/2)^2}{10}} \\ &=2\sqrt{0.2+0.05+0.025} \\ &=2\sqrt{0.275} \approx 1.049. \end{aligned}\]

WarningPractice Problem

Practice Problem 32 (ANOVA sums of squares). For an ANOVA problem with \(k=4\) groups and \(N=20\) observations, suppose \[\mathrm{SSB}=120, \qquad \mathrm{SSE}=180.\] Compute \(\mathrm{SST}\), \(\mathrm{MSB}\), \(\mathrm{MSE}\), and \(F_{\mathrm{obs}}\).

CautionSolution

The total sum of squares is \[\mathrm{SST}=\mathrm{SSB}+\mathrm{SSE}=120+180=300.\] The degrees of freedom are \[k-1=3, \qquad N-k=16.\] Thus \[\mathrm{MSB}=\frac{120}{3}=40, \qquad \mathrm{MSE}=\frac{180}{16}=11.25.\] The observed \(F\) statistic is \[F_{\mathrm{obs}}=\frac{40}{11.25}=3.556.\]

WarningPractice Problem

Practice Problem 33 (Interpreting an ANOVA result). Suppose a one-way ANOVA test rejects \[H_0:\theta_1=\theta_2=\theta_3=\theta_4.\] What can and cannot be concluded?

CautionSolution

We can conclude that the data provide evidence that at least two treatment means are different. We cannot conclude that all four means are different. We also cannot conclude which pairs differ without follow-up inference, such as planned contrasts or multiple-comparison procedures.

35 Summary

This section introduced the foundations of one-way ANOVA.

TipKey idea

Key takeaways.

  • One-way ANOVA generalizes the two-sample pooled \(t\)-test to \(k\) groups.

  • The cell-means model is \(Y_{ij}=\theta_i+\varepsilon_{ij}\).

  • The global ANOVA null is \(H_0:\theta_1=\cdots=\theta_k\).

  • Contrasts are linear combinations \(\sum_i a_i\theta_i\) with \(\sum_i a_i=0\).

  • The ANOVA decomposition is \(\mathrm{SST}=\mathrm{SSB}+\mathrm{SSE}\).

  • The \(F\) statistic is \(F=(\mathrm{SSB}/(k-1))/(\mathrm{SSE}/(N-k))\).

  • Under the null, \(F\sim F_{k-1,N-k}\).