32  Case Study: The Cambridge/Humboldt Fellowship Study

NoteWhat you’ll be able to do

By the end of this chapter you will be able to:

  1. Reshape real wide-format hormone data to long format for analysis.
  2. Run and interpret a mixed ANOVA (win/loss × time point), including the interaction.
  3. Recognize why win/loss’s random assignment licenses a causal claim that other variables in this dataset (like sex or match type) do not.
  4. Extend the same workflow to new outcome variables on your own.

The Cambridge/Humboldt dataset is the showpiece case for repeated-measures and mixed designs. It comes from a published study (Oxford et al., 2017, PLOS ONE) on the hormonal correlates of competition outcomes. Subjects competed either 1-vs-1 or as part of a 2-vs-2 team; hormones were sampled at three time points (baseline, immediately after the contest, and ~20 minutes later); winners and losers were compared. This chapter works through the 1-vs-1 case; the assignment sequence linked below extends the same analysis to the complete design, including team matches.

This is the dataset where the wide-vs-long reshaping skill from Chapter 9, and the afex-based mixed ANOVA from Chapter 19, actually get exercised.

32.1 The dataset

Each row is one subject, with wide-format repeated measurements of four hormones at three time points:

Variable Description Type
subject Subject ID Integer/factor
win Match outcome (Loss/Win) Factor (between-subjects)
t1, t2, t3 Testosterone at three time points Numeric (continuous, repeated)
e1, e2, e3 Estradiol at three time points Numeric
p1, p2, p3 Progesterone at three time points Numeric
c1, c2, c3 Cortisol at three time points Numeric

Plus additional one-time variables: BIS/BAS scores (bis_all, bas_all), weight (weight_kg), height (height_cm), and sex.

The design has:

  • One between-subjects factor: win (yes/no).
  • One within-subjects factor: time (t1/t2/t3) for each hormone.

That makes the natural analysis a mixed ANOVA with hormone level as the outcome.

Importantwin was randomly assigned — but don’t assume everything else was too

Studies that induce competition in a laboratory setting require careful ethical oversight: participants should provide informed consent, and any deception about the contest outcome should be explained at debriefing. Hormone sampling requires separate consent covering how biological samples will be stored, analyzed, and shared. Any psychological distress from losing — particularly in a head-to-head design — should be addressed in debriefing.

Here, the contest outcome (win) was secretly rigged by the experimenters, not earned: participants believed they were competing on skill, but designated winners won 8 of 10 rounds and designated losers lost 8 of 10 rounds regardless of their actual performance. Because win was experimentally assigned rather than a real outcome participants achieved, a hormone difference between winners and losers can be attributed to winning or losing itself — the same causal logic as a randomized drug trial.

That logic does not extend to every variable in this dataset. sex, match (1v1 vs. 2v2), and individual-difference measures like implicit motive scores were not randomly assigned — participants brought those with them. A hormone difference associated with sex or match could reflect any number of pre-existing differences between those groups, not a causal effect of being male, female, on a team, or alone. Keep straight which factor in a given analysis was actually manipulated before making a causal claim.

32.2 Setup

Run the standard setup from the Student Overview before working through this chapter — it loads cam and labels win, match, and sex as factors. This chapter analyzes the 1v1-women subset:

cam_1v1w <- subset(cam, match == "1v1" & sex == "Female")

32.3 Question 1: Reshape to long format

The data come in wide format (one row per subject, four hormones × three times = twelve columns). Repeated-measures ANOVA needs long format. The reshape is the trick covered in Chapter 9.

library(tidyverse)

# Select only the repeated hormone columns before reshaping. Selecting first
# matters here: this dataset also has an htt1-htt4 mood variable, and a
# broader column selection (e.g. "everything except subject and win") would
# let the reshape pattern below match "t1" inside "htt1" by accident,
# silently corrupting the testosterone column.
cam_reshape <- cam_1v1w %>%
  select(subject, win, t1, t2, t3, e1, e2, e3, p1, p2, p3, c1, c2, c3)

long_df <- pivot_longer(
  cam_reshape,
  cols = -c(subject, win),
  names_to = c(".value", "time"),
  names_pattern = "([a-z])([1-3])"
)

# Convert time to numeric
long_df$time <- as.numeric(long_df$time)

# Inspect
head(long_df)
str(long_df)

The .value pattern combined with the regex ([a-z])([1-3]) is what makes this work: the lowercase letter (t/e/p/c) becomes a column name, and the digit (1/2/3) becomes the time variable. After this, you have subject, win, time, t, e, p, c — one row per subject per time point, with all four hormones in their own columns.

This is one of those tidyverse moves that looks like magic the first time but becomes essential once you understand it.

NoteSome participants are missing hormone data

Not everyone has a valid reading at all three time points for every hormone. You don’t need to filter this out by hand — aov_ez() (Question 2) automatically drops any subject missing data for the specific hormone being modeled and prints a warning with the number of subjects excluded (it lists only the first 10 IDs). Read that warning, and check how many subjects remain with nrow(model$data$wide): the n can differ from one hormone to the next (72 for testosterone, 68 for cortisol).

32.4 Question 2: Mixed ANOVA on testosterone

The headline analysis. Does testosterone change over time, and does the time course differ between winners and losers?

library(afex)
library(emmeans)

# Convert to factors as needed
long_df$win  <- as.factor(long_df$win)
long_df$time <- as.factor(long_df$time)
long_df$subject <- as.factor(long_df$subject)

# Fit the mixed ANOVA
model <- aov_ez(
  id = "subject",
  dv = "t",                     # testosterone
  between = "win",
  within  = "time",
  data = long_df
)

summary(model)
model   # compact table: corrected df, p-values, and ges (η_G²)

Read the summary() output for Mauchly’s test of sphericity. Then report the Greenhouse-Geisser-corrected df and p-values from the compact table that printing model gives; its ges column is η_G², reported for every effect, significant or not.

You get three effects:

  • Main effect of win — do winners and losers differ on average?
  • Main effect of time — does testosterone change over time, averaging over winners and losers?
  • win × time interaction — does the time course of testosterone differ between winners and losers?

The interaction is the substantively interesting effect. In this subset, testosterone declines over the session in winners and losers alike: the time effect is significant, F(1.95, 136.44) = 24.40, p < .001, η_G² = .02, but neither the win effect (p = .176) nor the win × time interaction (p = .668) is. These data do not show different testosterone time courses for winners and losers.

# Pairwise within each group
emmeans(model, pairwise ~ time | win, adjust = "tukey")

32.5 Question 3: The other hormones

The analysis can be repeated for estradiol, progesterone, and cortisol. Some show patterns; others don’t. In this subset, cortisol declines across the three time points in both groups, F(1.33, 88.02) = 34.90, p < .001, η_G² = .06, with no win × time interaction (p = .795). With only one pre-match sample, these data cannot show whether cortisol rose before the match.

# Same model, different DV
model_c <- aov_ez(id = "subject", dv = "c",
                  between = "win", within = "time",
                  data = long_df)
summary(model_c)
model_c

32.6 Question 4: One-time variables and BMI grouping

The dataset also has one-time variables — weight, height, BIS/BAS scores. These can be used in different analyses:

  • Regression: does weight predict baseline testosterone (t1)? lm(t1 ~ weight_kg, data = cam_1v1w).
  • Group comparison from a continuous variable: split BMI into high/low and do a t-test or ANOVA on hormones.

Analyses this dataset supports include:

  • Repeated-measures hormone change post-win
  • BMI-grouped t-test on testosterone
  • Weight-predicts-testosterone regression
  • BIS/BAS scores predicting hormone profiles
TipA suggested workflow for the Cambridge data
  1. Open the data, identify which columns are repeated measurements.
  2. Reshape to long format using pivot_longer with .value (see Chapter 9).
  3. Convert factors as needed.
  4. Plot mean testosterone over time, colored by win/loss group.
  5. Fit a mixed ANOVA with aov_ez() (between = win, within = time).
  6. Interpret the main effects and the interaction.
  7. Follow up with emmeans() for significant effects.
  8. Repeat for any other hormone of interest.
  9. Write up the most interesting hormone’s results in APA format.
NoteCambridge/Humboldt Dataset Assignments

The full assignment sequence for this dataset — from descriptives through an open-ended capstone — is available here:

Assignments 1–3 use the 1v1-women subset covered in this chapter; Assignment 4 expands to the complete design — all four match × sex groups.

The final case study takes a small dataset with a categorical predictor and shows where regression and ANOVA become the same test.


TipChapter Summary

Core idea: A real repeated-measures study from start to finish: wide hormone data reshaped to long, a mixed ANOVA fit with afex, and an interaction interpreted in context. This is the only dataset in the course that genuinely requires reshaping — which is exactly why it’s here.

You should understand:

  • Why the repeated time points make this a within-subjects problem that ordinary aov() mishandles
  • What a win/loss × time interaction would mean for the hormone story
  • Why win being experimentally assigned (rigged, not earned) licenses a causal claim that sex and match — both unmanipulated — do not

You should be able to do in R:

  • Reshape with pivot_longer() (including the .value pattern for multiple hormones)
  • Fit a mixed ANOVA with aov_ez(between = ..., within = ...) and read η_G²
  • Follow up significant effects with emmeans()

Plain-language check: Testosterone differs between winners and losers after the match, and it also differs between men and women. One of these differences licenses a causal claim; the other doesn’t. Which is which, and why?

The one mistake to avoid: Analyzing the wide-format columns as if they were independent groups. Three time points from the same person are not three samples of different people.

Practice: Pick a second hormone and run the same pipeline. Does its pattern match testosterone’s?

Key terms from this chapter are defined in the Glossary.