Statistics 2nd ed

within-subjects-design

Repeated-Measures ANOVA

rm profile
rm sem
rm partitioning var
f distrib
rm sphericity

Goal. Test whether performance changes across four conditions measured on the same participants.

Design & Experiment

  • Within-subjects factor: Condition with 4 levels (C1, C2, C3, C4).
  • s = 8 participants measured in k = 4 conditions ⇒ total observations \(N = s \times k = 32\).
  • Example context: the same students take four weekly quizzes after different study activities.

Figure 1: Profile plot (each subject as a line across the four conditions).


Data

Scores (rows = participants S1–S8; columns = conditions C1–C4):

SubjectC1C2C3C4Row sumRow mean
S17074758130075.00
S27375788230877.00
S36873737829273.00
S47479818531979.75
S57174788230576.25
S67072767829674.00
S77377808431478.50
S87477808431578.75
Column sums573601621654Grand sum = 2449Grand mean \( \bar X = 2449/32 = 76.53125 \)

Figure 2: Means ± SEM for C1–C4 (bar/line).


Step 1 — Condition Means (and sample variances)

\[ \begin{aligned} \bar X_{\mathrm{C1}} &= 573/8 = 71.625, \quad & s^2_{\mathrm{C1}} &= 4.8393 \\ \bar X_{\mathrm{C2}} &= 601/8 = 75.125, \quad & s^2_{\mathrm{C2}} &= 5.5536 \\ \bar X_{\mathrm{C3}} &= 621/8 = 77.625, \quad & s^2_{\mathrm{C3}} &= 7.6964 \\ \bar X_{\mathrm{C4}} &= 654/8 = 81.750, \quad & s^2_{\mathrm{C4}} &= 7.0714 \end{aligned} \]


Step 2 — Sums of Squares

Notation: \(s=8\) subjects, \(k=4\) conditions, grand mean \( \bar X = 76.53125\).

2A. Total

\[ SS_{\text{total}}=\sum_{i=1}^{s}\sum_{j=1}^{k}\bigl(X_{ij}-\bar X\bigr)^2 =\mathbf{611.96875}. \]

2B. Conditions (Treatment)

\[ SS_{\text{cond}}= s \sum_{j=1}^{k}\bigl(\bar X_{\cdot j}-\bar X\bigr)^2 = 8 \left[(71.625-76.53125)^2 + (75.125-76.53125)^2 + (77.625-76.53125)^2 + (81.75-76.53125)^2\right] =\mathbf{435.84375}. \]

2C. Subjects

\[ SS_{\text{subj}}= k \sum_{i=1}^{s}\bigl(\bar X_{i\cdot}-\bar X\bigr)^2 = 4 \sum_{i=1}^{8}\bigl(\bar X_{i\cdot}-76.53125\bigr)^2 =\mathbf{162.71875}. \]

2D. Error (Residual)

\[ SS_{\text{error}}= SS_{\text{total}} - SS_{\text{cond}} - SS_{\text{subj}} = 611.96875 - 435.84375 - 162.71875 =\mathbf{13.40625}. \]

Figure 3: Partitioning variance diagram (Total → Conditions + Subjects + Error).


Step 3 — Degrees of Freedom & Mean Squares

\[ \begin{aligned} df_{\text{cond}} &= k-1 = 3, \\ df_{\text{subj}} &= s-1 = 7, \\ df_{\text{error}} &= (s-1)(k-1) = 7\times3 = 21, \\ df_{\text{total}} &= sk-1 = 31. \end{aligned} \]

\[ MS_{\text{cond}} = \frac{SS_{\text{cond}}}{df_{\text{cond}}} =\frac{435.84375}{3}=\mathbf{145.28125},\qquad MS_{\text{error}} = \frac{SS_{\text{error}}}{df_{\text{error}}} =\frac{13.40625}{21}=\mathbf{0.6383928571}. \]


Step 4 — Test Statistic & p-value

\[ F = \frac{MS_{\text{cond}}}{MS_{\text{error}}} = \frac{145.28125}{0.6383928571} =\mathbf{227.5734}. \] With \(df_1=3\) and \(df_2=21\), this is extremely large. The right-tail p-value is effectively \(p \lt 10^{-12}\) (i.e., \(p \ll .001\)).

Figure 4: F distribution with observed F marked and right-tail region shaded.


Repeated-Measures ANOVA Summary Table

SourceSSdfMSFp
Conditions (within)435.843753145.28125227.5734< 1e-12
Subjects162.71875723.24554
Error (residual)13.40625210.63839
Total611.9687531

Interpretation

Mean performance increases steadily from C1 → C4, and the repeated-measures ANOVA shows a highly significant effect of Condition, \(F(3,21)=227.57,\, p\ll .001\). Follow-ups (e.g., paired t-tests with Bonferroni/Holm) can localize which pairs of conditions differ.

Assumptions (checklist)

  • Sphericity (equal variances of the differences between condition pairs). If violated, apply Greenhouse–Geisser or Huynh–Feldt correction to \(df\).
  • Approximately normal scores within each condition.
  • No carryover/fatigue effects that confound order (counterbalancing helps).

Figure 5: Sphericity concept sketch (pairwise difference variances).

Practice self-test quiz

In the space below, please find practice problems and self-test quizzes. For full access, please signup free.

Lecture 9 — Mixed (Split-Plot) ANOVA

mixed anova summary table
mixed ANOVA split plot interaction
mixed anova summary table

A mixed design combines a between-subjects factor (different groups of participants) with a within-subjects factor (the same participants measured repeatedly).
It is also called a split-plot design.

This design is common in psychology, education, and medicine.
Example: groups of patients (between factor) measured at different time points (within factor).


Structure of the Design

  • Between-subjects factor: separate groups of participants (e.g., Drug vs. Placebo).
  • Within-subjects factor: repeated measures on each participant (e.g., Week 1, Week 2, Week 3).
  • Interaction: tests whether the effect of the within factor depends on the between factor.

Degrees of Freedom

For a design with:

  • $$a$$ levels of the between-subjects factor
  • $$b$$ levels of the within-subjects factor
  • $$n$$ subjects in total
  • Between: $$df_{\text{between}} = a - 1$$
  • Subjects (within groups): $$df_{\text{subjects}} = N - a$$
  • Within: $$df_{\text{within}} = b - 1$$
  • Interaction: $$df_{A \times B} = (a-1)(b-1)$$
  • Error terms depend on design partitioning.

Example

Two groups of students (Drug, Placebo) are tested across three weeks.

GroupWeek 1Week 2Week 3
Drug708090
Placebo707274
  • Between factor (Group): Drug vs. Placebo
  • Within factor (Time): Weeks 1–3
  • Interaction: Drug improves over time, Placebo stays flat

Symbolic Formula

$$F = \frac{MS_{\text{effect}}}{MS_{\text{error}}}$$

Where $$\text{effect}$$ may be between, within, or interaction, depending on the hypothesis.


Definition

  • Mixed (split-plot) ANOVA: combines a between factor (different groups) and a within factor (repeated measures).
  • Use: tests real-world designs where groups are compared across time or conditions.

Visuals

Figure L9.1 — Mixed ANOVA Layout. Two groups (Drug, Placebo) × three repeated measures (Weeks 1–3).

Figure L9.2 — Mixed ANOVA Interaction Plot. Drug group line rises sharply; Placebo line flat.

Figure L9.3 — ANOVA Summary Table for mixed design.


Why This Matters

Mixed designs are realistic and powerful.
They reflect how experiments are often run: groups compared across time.
This design unites the logic of between- and within-subjects testing.

Practice self-test quiz

In the space below, please find practice problems and self-test quizzes. For full access, please signup free.

Lecture 8 — Repeated-Measures ANOVA

repeated measures profile
repeated measures anova summary

In a repeated-measures design, the same participants are tested under multiple conditions.
This reduces error, because each person serves as their own control.
It is more powerful than a one-way ANOVA with independent groups.


Structure of the Design

  • Rows (subjects): variation due to individual differences
  • Columns (conditions): variation due to treatments
  • Error: leftover variability after accounting for rows and columns

Degrees of Freedom

  • $$df_{\text{rows}} = n - 1$$
  • $$df_{\text{columns}} = k - 1$$
  • $$df_{\text{error}} = (n - 1)(k - 1)$$

Where:

  • $$n$$ = number of subjects
  • $$k$$ = number of conditions

Example

Five students are tested under three conditions:

SubjectCond 1Cond 2Cond 3
S1707580
S2687479
S3727783
S4697378
S5717682
  • Means increase steadily across conditions.
  • ANOVA will partition the variance into Rows, Columns (treatments), and Error.

Symbolic Formula

$$F = \frac{MS_{\text{columns}}}{MS_{\text{error}}}$$

Formula in words:
$$F = \frac{\text{mean square for conditions}}{\text{mean square for error}}$$


Definition

  • Repeated-measures ANOVA: compares means of the same group measured under different conditions.
  • Advantage: controls for subject differences, increases statistical power.

Visuals

Figure L8.1 — Repeated-Measures Profile Plot. Each subject shown as a line across conditions.

Figure L8.2 — ANOVA Summary Table for repeated measures. Rows | Columns | Error.


Why This Matters

Repeated-measures designs are common in psychology, neuroscience, and medicine.
They allow researchers to detect changes over time or across treatments with fewer subjects and greater sensitivity.

Practice self-test quiz

In the space below, please find practice problems and self-test quizzes. For full access, please signup free.