Week5 interaction effect modification

Week 5 — Effect modification and interaction: learn the distinction, then stress-test it

Duration: ~2.5 h (Tue 6 Oct, before the Thu 8 Oct lab). Deck: lectures/slides/Week5_interaction_slides.qmd. Its MASLD numbers come from lectures/analysis/Week5_joint_exposure.R (written to Week5_joint_exposure.json) and from the P3 and M1 result objects (examples/_results/). The code and output on its “In R” slides come from lectures/analysis/Week5_code_outputs.R, which runs each block exactly as shown and records what R printed.

The design. Teach the clean 2 × 2 idea first, on a made-up fixed-follow-up example (smoking, income, hypertension), where the two questions can be read straight off the table. Then use MASLD as the stress test: the same two questions on the paper’s four phenotype groups, where time order, sparse cells and selection make the causal reading hard. R code sits next to the concept it computes; every causal assumption, target population and contrast is stated on the slide.

Timing. The deck’s speaker notes give 142 minutes of content and no break slot. With the usual 10-minute break (placed below after Slide 18, before “Count first”) that is 152 minutes — 2 over the 150-minute class. Take the two minutes from If you are running behind at the foot of this file. If you retime a slide, retime it in the deck’s notes too; this plan copies their minutes.

Built on Week 4. Same rows (5,911; 534 deaths), same pre-exposure adjustment set L (age, sex, race/ethnicity, smoking, sedentary time), same DAG style, Week 4’s collapsibility table reread for modification (Slide 13), and Week 4’s g-computation idea extended to standardised survival (Slides 23–26).

Row-set discipline. Every quantitative slide names its rows. - 5,911 — Week 4’s rows: the locked domain complete on every covariate of the paper’s Model 2 and the pre-exposure set. All of the MASLD analysis in Part 3 and Part 4’s interaction slides. - 6,048 — the locked domain itself: only the crude IV-vs-I table by sex (Slides 33–35), the rows P3’s code uses. - 1,296 — P3’s rows, from the paper replication (Groups III + IV of the 6,048 complete on the paper’s Model 1 covariates): Slide 36’s crude and Model 1 ratios and its six-year RDs, and M1’s design-weighted hand-off on Slide 40. 1,291 (Groups III + IV within the 5,911): this lecture’s set-L sex test on Slide 36 (168 deaths). These model sample sizes and event counts are emitted directly from the fitted Cox objects.

What this week does NOT do. Survey weights are Week 6: every number here is unweighted, apart from Slide 40’s pointer to Week 6. RERI, AP and S are in the appendix and the lab, not the core lecture. Propensity-score methods for subgroup effects (Karim, ch. 8, §8.6) come after the propensity-score weeks.

Learning objectives

By the end, students answer the deck’s five questions, in order (Slide 2):

  1. Am I changing one exposure (effect modification) or imagining two exposures jointly (interaction)?
  2. What is my modifier M, and could A change M?
  3. On what scale am I comparing effects — additive or multiplicative?
  4. What do the four cells actually contain?
  5. What should I report, with uncertainty, without over-interpreting it?

…and can write the R for each step: cell counts, stratum-specific HRs from a product term and the likelihood-ratio test, standardised six-year risks, and the interaction contrast.

Continuity


Opening · 6 minutes

Slide 1 — Two questions hiding in the same 2 × 2 table (4 min)

Slide 2 — The map for today (2 min)

Part 1 · Learn the distinction on a clean example · 24 minutes

Slide 3 — Start with smoking, income, and hypertension (3 min)

Slide 4 — Question 1: effect modification (4 min)

Slide 5 — In R: read smoking’s effect within each income group (3 min)

Slide 6 — Question 2: interaction (5 min)

Slide 7 — In R: interaction on two scales (3 min)

Slide 8 — Same table, different question (3 min)

Slide 9 — Confounding is a third idea (3 min)

Part 2 · A practical workflow for effect modification · 21 minutes

Slide 10 — A five-step workflow (3 min)

Slide 11 — The modifier must survive the “could A change it?” test (5 min) · do not drop

Slide 12 — What do we adjust for? (5 min)

Slide 13 — Name the scale before saying “no modification” (4 min)

Slide 14 — Two scales are enough for the core lecture (4 min)

Part 3 · Now stress-test the idea with MASLD · 53 minutes, with the break after Slide 18

Slide 15 — The MASLD question we will try to answer (2 min)

Slide 16 — Why the MASLD example becomes causally difficult (4 min)

Slide 17 — Causal audit: can obesity really be the modifier? (7 min) · do not drop

Slide 18 — What the effect-modification interpretation assumes (5 min)

BREAK (10 min) — not in the deck’s notes; put it here

Slide 19 — Count first (3 min)

Slide 20 — In R: count before you model (3 min)

Slide 21 — One product-term model, two stratum-specific HRs (4 min)

Slide 22 — In R: recover both HRs and test the product term (4 min)

Slide 23 — Why compute standardised six-year risks? (4 min)

Slide 24 — Additive scale: the standardised six-year results (3 min)

Slide 25 — In R: use the same people twice, changing only waist fat (4 min)

Slide 26 — In R: turn the four predictions into risk differences (2 min)

Slide 27 — Put both scales on one page (4 min)

Slide 28 — The paper’s IV vs I comparison asks a different question (4 min)

Part 4 · Interaction, survival tools, and reporting · 38 minutes

Slide 29 — If obesity is a second exposure, the estimand changes (5 min)

Slide 30 — In R: interaction with the same A and M coding (2 min)

Slide 31 — In R: the additive interaction contrast (2 min)

Slide 32 — The right survival tool depends on the scale (4 min)

Slide 33 — A dramatic subgroup claim can be built on almost no information (3 min)

Slide 34 — In R: reproduce the crude IV-vs-I HRs (3 min)

Slide 35 — In R: now count the reference events (2 min)

Slide 36 — Ask the subgroup question cleanly (4 min)

Slide 37 — In R: one test for sex modification on the locked contrast (3 min)

Slide 38 — Honest subgroup reporting (3 min)

Slide 39 — The algorithm to take into your own paper (3 min)

Slide 40 — Key takeaways (4 min)

Appendix (uncounted)


Thursday — L4 (EpiMethods confoundingE2) · for the TA and the instructor, not in the deck

The deck carries no lab bridge; the L4 handout carries the short version of these notes. They are worth five minutes at the start of Thursday’s session.


If you are running behind

The notes run 142 minutes; with the break, 152. Cut in this order.

  1. Slides 30–31 — interaction in R (4 → 1 min). Say “same product term; IC 3.9 over one common population” and move on.
  2. Slides 34–35 — the crude IV-vs-I code (5 → 2 min). Show the counts slide only.
  3. Slide 23 — why standardise (4 → 2 min). Slide 25’s code walks through it anyway.
  4. Slide 9 — confounding is a third idea (3 → 1 min).

Never drop Slides 11, 17, 19 or 27. The could-A-change-M rule, the causal audit, the cell counts and the two-scale summary are the argument.

Reading map — each segment and where students can review it

Segment EpiMethods / course page Key reference
Definitions (Slides 3–9) confounding0 Concepts, “Formal Definitions”; effect-modification video and slides VanderWeele 2009; Bours 2021; Karim ch. 8 §8.2–8.5
The modifier rule, adjustment sets (Slides 11–12, 17–18) confounding0, “Implications for Confounding Control” Karim ch. 8, Fig. 8.1
Scale (Slides 13–14) confounding0, “The Role of the Scale”; confounding5 (Week 4) VanderWeele & Knol 2014
Joint variable vs product term; RERI, AP, S (appendix) confounding9; interaction tutorial Knol et al. 2011; Hosmer & Lemeshow 1992
Reporting (Slides 38–39) confounding0, “Reporting guideline” Knol & VanderWeele 2012; Karim ch. 8 §8.7
Thursday confoundingE2, confoundingE2solution —

Before assigning the reading.

Appendix — the two questions as dagitty code

dag {
  Waist [exposure]  Death [outcome]  U [latent]
  L -> Obese  L -> Waist  L -> Death
  U -> Obese  U -> Death
  Obese -> Waist  Obese -> Death  Waist -> Death
}

With Waist as the only exposure dagitty returns {L, Obese}. Add Obese as a second exposure and no set exists; remove the latent tag from U and {L, U} appears. Each of Slide 18’s assumptions, broken, removes Panel A’s set: reverse Obese -> Waist; add U -> Waist; add a latent G -> Obese, G -> Waist; add a latent income node; or add FLI [adjusted] Waist -> FLI Waist -> TG TG -> FLI TG -> Death.

References