Run the standard setup from the Student Overview before starting
this assignment. This assignment uses the full cam
dataset — all four match × sex groups — not the 1v1-women subset from
Assignments 1–3.
Does testosterone’s response to winning or losing depend on whether someone competed 1v1 or 2v2, and on their sex?
This is the actual research question the Cambridge/Humboldt study was
designed to answer. It requires three between-subjects
factors (win, match,
sex) crossed with one within-subjects
factor (time) — a mixed ANOVA, the same design
introduced in @sec-anova-repeated-mixed
and Chapter 31, now run on the complete dataset instead of one condition
at a time.
| Variable | Meaning | Type |
|---|---|---|
t1, t2, t3 |
Testosterone before, immediately after, and ~20 min after the contest | Quantitative (repeated) |
win |
Loss / Win | Categorical (between-subjects) |
match |
1v1 / 2v2 | Categorical (between-subjects) |
sex |
Female / Male | Categorical (between-subjects) |
t1,
t2, t3 as separate columns. What is this
format called?time column indicating
which time point that row is. What is this format called?aov_ez() (or any repeated-measures function)
work directly on the wide format?library(tidyverse)
cam_reshape <- cam %>%
select(subject, win, match, sex, t1, t2, t3, e1, e2, e3, p1, p2, p3, c1, c2, c3)
long_df <- pivot_longer(
cam_reshape,
cols = -c(subject, win, match, sex),
names_to = c(".value", "time"),
names_pattern = "([a-z])([1-3])"
)
long_df$time <- as.numeric(long_df$time)
head(long_df)
str(long_df)This is the same .value reshape trick from Chapter 31 —
the lowercase hormone letter becomes a column name, and the digit
becomes time. The difference here is that win,
match, and sex all carry over as
between-subjects columns, since we’re now using every condition instead
of just one.
library(afex)
library(emmeans)
long_df$subject <- as.factor(long_df$subject)
long_df$time <- as.factor(long_df$time)
model_t <- aov_ez(
id = "subject",
dv = "t",
between = c("win", "match", "sex"),
within = "time",
data = long_df
)
summary(model_t)This model tests every main effect (win,
match, sex, time) and every
interaction between them, including the three-way
win:match:sex interaction and its interaction with
time — the four-way win:match:sex:time
interaction is the one this whole study was designed to detect.
sex on
testosterone? Given what you know about male versus female testosterone
levels biologically, is this surprising?win:match:sex:time interaction
significant? What would a significant four-way interaction mean in plain
language — that the win/loss effect on testosterone over time depends on
what, exactly?An ANOVA table with a significant four-way interaction is hard to interpret from numbers alone. Visualize it directly:
ggplot(long_df, aes(x = time, y = t, color = win, group = win)) +
stat_summary(fun = mean, geom = "line", linewidth = 1) +
stat_summary(fun = mean, geom = "point", size = 2) +
facet_grid(match ~ sex) +
labs(x = "Time Point", y = "Mean Testosterone (transformed)",
title = "Testosterone Across Time by Win/Loss, Match Type, and Sex")A note on matching the published result exactly: The original paper analyzed hormone change using repeated-measures ANCOVA with baseline hormone (T1) as a covariate, rather than a plain mixed ANOVA on the raw repeated values as you just ran. Controlling for baseline this way corrects for chance imbalances between groups at T1 (which can happen even with random assignment) — a technique beyond this course’s scope. Your mixed ANOVA should show the same qualitative interaction pattern, but don’t expect your exact F values or the visual pattern to line up perfectly with the published figures.
Repeat Question 2 and Question 3 using cortisol (c)
instead of testosterone. The published paper found a different pattern
for cortisol than for testosterone — cortisol was differentially
associated with outcome specifically in the team matches.
| Effect | F | df | p | ges |
|---|---|---|---|---|
win |
||||
match |
||||
sex |
||||
win:match:sex:time |
A mixed ANOVA was conducted on testosterone with win/loss, match type, and sex as between-subjects factors and time as a within-subjects factor. [Describe the significant effects you found, using generalized eta-squared (ges) as the effect size, and describe the four-way interaction in plain language if significant.]
win effect that we couldn’t
conclude for, say, the pill variable in Assignment 2?sex and match (whether someone signed up
for/was assigned to a 1v1 or 2v2 session) were not randomly assigned to
participants in the same causal sense as win. How does that
change what we can conclude about why the pattern differs
across sex or match type?