Contents/ Part XXVII · Capstone Projects: Statistical Testing/ Chapter 165

Does Cognitive Training Keep Working?

Capstone 6. The same participants, assessed four times over twelve weeks. Repeated measures buy power, but they bring a new assumption called sphericity and a new bias risk in the people who drop out. Both change what we are allowed to conclude.

⏱️ ~18 min read
🧪 Repeated-measures ANOVA
📊 Chapter 165

Capstone 5 compared three separate groups of students. This one compares four measurements of the same people. That pairing is powerful, for the reason the paired t-test was powerful in Capstone 3: person-to-person differences cancel out. But with more than two conditions, a new condition has to hold, and here it does not.

The brief
Setting
A twelve-week cognitive-training program assessed the same participants at Baseline, Week 4, Week 8 and Week 12.
The question
Do scores change across the program, and when does the change actually happen?
Why it matters
If nearly all the gain arrives by Week 4, the last eight weeks are cost without benefit and the program can be shortened without losing anything.
What we do
Run a one-way repeated-measures ANOVA, test sphericity and correct for it, locate the change across timepoints, and account for the participants who dropped out along the way.
Repeated-measures ANOVA tests whether a continuous outcome changes across three or more conditions measured on the same subjects. Beyond normality it assumes sphericity: that the variance of the difference between any two conditions is the same for every pair. Mauchly's test checks it, and the Greenhouse-Geisser correction repairs the test when it fails.
🧠
The finding, up front

Scores did improve, and the result survives correction: F(2.12, 72) = 7.16, corrected p = 0.001. But the shape matters more than the fact. Participants gained about 4.5 points in the first four weeks and then plateaued: Weeks 8 and 12 are statistically indistinguishable from Week 4. And 7 of 42 participants had to be dropped, which is its own warning.

1

The Question and the Design

A twelve-week cognitive-training program assessed the same participants at Baseline, Week 4, Week 8, and Week 12. The question is whether scores change over the program, and, just as usefully, when.

Framework stepThis project
GoalDecide whether mean cognitive score changes across four timepoints, and locate the change.
HypothesesH₀: all four timepoint means are equal  vs  H₁: at least one differs. α = 0.05.
Data typeContinuous outcome across a four-level within-subject factor.
DesignOne-way repeated measures: every participant contributes all four scores.
2

Complete Cases Only, and What That Costs

A repeated-measures ANOVA can only use participants with a full set of measurements: one missing assessment and the whole person drops out of the analysis. After removing duplicate rows, blank scores, and impossible values, and then filtering to complete cases, 42 enrolled participants became 35. Those 7 exclusions are not a rounding detail, and Section 6 returns to why.

Two panels. On the left, one thin gray line per participant showing their cognitive score across the four timepoints, with a bold gold line for the group mean rising from about 52 to about 58; the individual lines visibly fan out over time. On the right, the four group means with 95% confidence intervals, rising steeply from Baseline to Week 4 and then almost flat.
Left: every participant's own trajectory, with the group mean in gold. Notice the lines fan out over time, a visual warning that the spread is growing. Right: the group means climb from Baseline to Week 4 and then flatten.
TimepointnMeanSDChange from baseline
Baseline3551.848.73
Week 43556.3810.00+4.54
Week 83556.9911.49+5.14
Week 123557.8713.90+6.02

Read the SD column as carefully as the mean column. The spread grows steadily, from about 8.7 at Baseline to 13.9 at Week 12. That growth is what breaks the assumption we check next.

3

Sphericity: the Assumption That Only Appears Now

With two conditions there is exactly one difference to compute, so there is nothing to compare it with. With four conditions there are six pairwise differences, and repeated-measures ANOVA assumes they are all equally variable. That is sphericity. When later measurements spread out more than earlier ones, differences involving those later points become more variable than the rest, and the assumption fails.

Sphericity: are all the pairwise differences equally variable? WHAT SPHERICITY ASSUMES pair 1pair 2pair 3 same width every time WHAT THIS STUDY SHOWS var 23var 55var 110 later timepoints spread out, so the differences do too Mauchly's test: W = 0.477, p = 0.0002, so sphericity is rejected.

The notebook makes this concrete by computing all six difference variances directly. They range from about 23 to 110, nearly a five-fold spread, and Mauchly's test rejects sphericity decisively.

A bar chart of the variance of the difference for all six pairs of timepoints. The bars rise from about 23 for the Baseline to Week 4 difference to about 110 for the Week 8 to Week 12 difference, with a dashed line marking the average. Sphericity would require all six bars to be the same height.
The six pairwise difference variances. Sphericity requires these bars to be the same height; they range from 23 to 110. This is the assumption failing, in one picture.
Why a violated sphericity assumption matters

An uncorrected repeated-measures F test with unequal difference variances is too liberal: it reports a smaller p-value than the evidence justifies, and so finds effects that are not there. The fix is not a different test but a correction to the degrees of freedom, which makes the test appropriately more conservative.

4

Correct the Test, Then Read the Shape

The Greenhouse-Geisser correction multiplies the degrees of freedom by epsilon, a measure of how far the data depart from sphericity. Epsilon is 1 when sphericity holds perfectly and shrinks as the violation worsens. Here ε = 0.71, which pulls the degrees of freedom from (3, 102) down to about (2.12, 72) and moves the p-value from 0.0002 to 0.0012.

The Greenhouse-Geisser correction, applied UNCORRECTED F(3, 102) = 7.16 p = 0.0002 too liberal here × ε ε = 0.71 CORRECTED (REPORTED) F(2.12, 72) = 7.16 p = 0.0012 honest degrees of freedom still p < 0.05 conclusion unchanged The correction changed the number, not the verdict. That is the hoped-for outcome, never the assumed one.
Corrected F
7.16
on 2.12 and 72 df
Corrected p
0.0012
Greenhouse-Geisser
Generalized η²
0.043
a modest share
Friedman
p < 0.001
rank-based, agrees

So something changed. The post-hoc comparisons, Holm-corrected across all six pairs, say what:

ComparisonHedges' gAdjusted pVerdict
Baseline vs Week 4−0.48< 0.0001real gain
Baseline vs Week 8−0.500.0002real gain
Baseline vs Week 12−0.510.0034real gain
Week 4 vs Week 8−0.061.00no further gain
Week 4 vs Week 120.121.00no further gain
Week 8 vs Week 120.071.00no further gain

The pattern is unambiguous: every comparison against Baseline is significant, and no comparison among Weeks 4, 8, and 12 comes close. All of the measurable benefit arrives in the first month.

A plot of change from baseline at Weeks 4, 8, and 12, each with a 95% confidence interval. The Week 4 point sits at about plus 4.5 points, well above the dashed zero line, and Weeks 8 and 12 sit only slightly higher with overlapping intervals, showing a plateau. An annotation points at Week 4 reading gain lands here.
Change from baseline. The gain arrives by Week 4 (about +4.5 points) and the curve then flattens: Weeks 8 and 12 add little and their intervals overlap Week 4's almost entirely.
5

The Verdict, and the Attrition Problem

Cognitive scores improved, and the improvement holds up after correcting for a genuinely violated assumption. The practical reading is about timing: the program earns its result in the first four weeks, and the remaining eight weeks add nothing detectable. Generalized eta-squared of about 0.04 is a modest share of total variation, so this is a real but not transformative effect.

The exclusion that deserves a second look

Seven of forty-two participants were dropped for incomplete data. If people left the program because they were not improving, then the analysis kept the responders and discarded the non-responders, and the reported gain is too optimistic. No statistical test detects this; it is a property of who is missing, not of the numbers that remain.

6

Repeated Measures in Data Science & AI

Any time the same units are measured under several conditions, the repeated-measures structure applies, and ignoring it treats dependent observations as independent.

Where it appearsThe repeated conditions
Model comparison on shared dataSeveral models scored on the same test items or the same cross-validation folds.
Longitudinal product metricsThe same cohort of users measured across several release windows.
Within-subject experimentsEach participant tries every interface variant (a crossover design).
Benchmark suitesOne machine run under several configurations, repeated across tasks.
Practice note

In modern practice the repeated-measures ANOVA is often replaced by a linear mixed-effects model, which handles unbalanced and incomplete data without discarding whole subjects, allows time to be modeled as a continuous trend rather than four separate levels, and sidesteps the sphericity assumption entirely by modeling the covariance structure directly. The ANOVA remains the clearer teaching instrument, and it is what most published work in this area still reports, so it is worth knowing both.

7

Estimate, and the Program Question Answers Itself

The corrected F-test said scores changed over the twelve weeks. It did not say how much was gained, or by when, and those are the questions a program sponsor is paying for.

Change from baselineMean95% confidence interval
Baseline to Week 4+4.54+2.89 to +6.19
Baseline to Week 8+5.14+2.89 to +7.39
Baseline to Week 12+6.02+2.68 to +9.36
Week 4 to Week 12+1.48−1.92 to +4.89
The row that decides the budget

Every interval measured from baseline sits clear of zero, so the improvement at each checkpoint is real. The last row is the one that matters commercially: from week 4 to week 12 the change is small and its interval straddles zero, meaning the extra eight weeks of training bought nothing this study can detect. The post-hoc tests already hinted at it, all three later timepoints being indistinguishable from one another. The interval states it as a magnitude, so a sponsor choosing between a four-week and a twelve-week course has an evidence-based answer, and it is not the one the twelve-week price tag assumes.

🐍

The full project, step by step

The companion notebook runs all twelve framework steps: it plots every participant's trajectory, cleans the file and filters to complete cases with a printed audit trail of who was excluded, computes all six pairwise difference variances to expose the sphericity problem, runs Mauchly's test, fits the repeated-measures ANOVA with pingouin and reports the Greenhouse-Geisser corrected result, runs Holm-corrected pairwise comparisons, and cross-checks with the Friedman test. Every number here comes from its output, with a plain-language note after each result.

📓 View Notebook (code & outputs) ▶ Open in Colab ⬇ View / Download on GitHub
Read the reports & get the data

The dataset (capstone-cognitive-training-over-time.xlsx) holds the assessments on the assessments sheet, with a codebook and notes, and it keeps the dropouts, blanks, duplicates, and impossible values so you can practice the complete-case filtering. Two written reports accompany it: a plain-language brief for a program director, and a technical report with the sphericity diagnostics, the corrected ANOVA, post-hoc contrasts, and references.

🎓 Key Takeaways

  • Repeated measures need complete cases: one missing assessment removes the whole participant, taking 42 enrolled down to 35 analyzed.
  • Sphericity is the new assumption: all pairwise difference variances should be equal. Here they ranged from 23 to 110, and Mauchly rejected it (p = 0.0002).
  • Correct, do not abandon: Greenhouse-Geisser (ε = 0.71) shrank the df from (3, 102) to (2.12, 72) and moved p from 0.0002 to 0.0012, still significant.
  • The post-hoc gave the shape: every comparison against Baseline was significant; none among Weeks 4, 8, and 12 was. The gain lands in month one and plateaus.
  • Attrition can flatter the result: if dropouts left because they were not improving, the complete-case estimate is too optimistic. A mixed-effects model uses partial records instead.
8

Quiz: Test Yourself

Eight questions on this capstone, from sphericity to attrition. Answer them, hit Check Answers, and keep refining until you score 100%. Your progress is saved.