Week4 confounding and table1

Week 4 — Confounding: what to adjust for, how to decide, and what the number can tell you

Duration: ~2.5 h (Tue 29 Sep, before the Thu 1 Oct lab). Deck: lectures/slides/Week4_confounding_slides.qmd — obesity (BMI) as the only exposure, the paper’s four BMI × waist groups kept for Week 5. Its numbers come from lectures/analysis/Week4_bmi_exposure.R.

The deck and this plan. This plan was written for an earlier deck that ran on the paper’s four phenotype groups; the deck now uses obesity vs not obese throughout, with the same figure style, Parts and plan-slide numbers. It covers Plan Slides 1–18 and 22; the Lab 3 bridge (Plan Slides 19–21) is not in the deck. Every deck slide’s speaker notes name its plan slide.

Two analyses, labelled. The deck’s numbers belong to the lecture’s exposure analysis: obesity vs not obese, with every hazard ratio on the same 5,911 rows, the pre-exposure set L (age, sex, race/ethnicity, current smoking, sedentary time) as its main adjustment and the paper’s Model 1 and Model 2 shown beside it. This plan’s phenotype-group numbers (IV vs III, IV vs I) belong to the paper replication: the paper’s Model 1 covariates on 5,939 rows, from the P2 and P4 exemplars; its Table 1 and full-file numbers are on 6,371 rows. The same IV-vs-III contrast differs between the two mainly because the adjustment set differs, not the rows: crude it is 2.34 on 5,939 rows and 2.31 on 5,911, but Model 1 gives 1.05 and set L 1.09 (P2 exemplar; lectures/analysis/Week6_design_aware.json). Every hazard ratio in this plan and the deck is unweighted, except the Week 6 pointer on Slide 22.

Timing. Per-slide markers below sum to 147 min including the break, against a 150-minute cap. Without Plan Slides 19–21 (15 min) the deck runs about 132 min. If you retime a slide, retime it in the deck’s notes too. See If you are running behind at the foot of this file.

Written for SPPH students, and matched to EpiMethods. The deck uses plain language (every term defined on first use), EpiMethods’ own notation (A, Y, L, U; Y(A=1), Y(A=0)), and the section names and order of the EpiMethods Concepts page for the Causal roles chapter. Each concept slide ends with a “Read more” line naming the matching Concepts section, EpiMethods tutorial or video, and the key paper; the deck closes with a Where to read more slide and the full reference list.

The lecture is one argument. On the same 5,939 rows, our locked hazard ratio (IV vs III, unweighted) moves from 2.34 to 1.05 when the paper’s Model 1 covariates enter. What moved it? There are three kinds of answer, and the lecture takes them in order: which variables were adjusted and what role each plays (the DAG, before the break); how those variables got chosen (the empirical criteria, and the data-driven methods that should not be used for this); and what the effect measure itself does on adjustment (collapsibility, after the break). A final block puts Thursday’s actual L3 exercise on screen, so the lab reads as the mechanics of the second half rather than as a change of subject.

Every DAG is drawn. Each structural claim in this lecture has a figure in lectures/img/w4_*.png, drawn in one visual language throughout: - Colour = role: exposure blue, outcome vermillion, confounder orange, mediator green, collider purple, any other variable grey. - Outlines and shapes: a dashed outline means not measured. A square node is conditioned on — adjusted, stratified, restricted or selected. - Arrows and bands: a grey arrow marked “?” is the effect we want. A highlighted band marks a causal path (solid green) or an open non-causal path (dashed red).

The DAGs behind Slides 8, 17 and 19 are printed as dagitty code in the appendix, so students can paste them into dagitty.net and check every adjustment-set statement themselves.

Row-set discipline. Every quantitative slide names the rows it quotes. Four sets carry today’s hazard ratios and counts, nested, and they are not interchangeable: - the full reconstructed analytic file, N = 6,371 — Table 1, group sizes, death counts; - the locked domain, N = 6,048 — the subset with a valid fasting weight; - its matched complete-case subset, N = 5,939 — the 6,048 less 109 people missing cancer status; this plan’s phenotype-group crude-versus-Model-1 hazard ratios are fitted here, so crude and adjusted differ for one reason rather than two; - the deck’s 5,911 — the 6,048 less 137 people missing a covariate of the deck’s largest models (Model 2 plus race/ethnicity); every hazard ratio on the deck, and Slide 17’s, is fitted on these same rows, for the same reason.

6,371 − 5,939 is not the complete-case loss; 109 is (137 for the deck’s rows). Slide 7’s collider panels use two earlier funnel sets: the 14,170 fasting-subsample adults with FLI computable, and the 6,052 of them with FLI ≥ 60.

What this week does NOT do. Whether an effect differs across subgroups, including whether WHtR’s effect differs between the obese and the non-obese, is effect modification (Week 5 and P3). Survey weights are Week 6; the missing-data mechanics (and L3’s complete-case step) are Week 7. Formal mediation analysis is not in this course. Today the phenotype is one exposure with one named contrast.

Learning objectives

  1. State the causal question an adjusted estimate is meant to answer, as opposed to a prognostic one, and the three conditions under which adjustment answers it: conditional exchangeability, positivity, consistency.
  2. Read a DAG: tell causal paths from back-door paths and from paths blocked at a collider; recognise the fork, chain and collider; and use the back-door rule to find a valid adjustment set — or to show that none exists with the variables measured.
  3. Assign each covariate a role — confounder, proxy, mediator, collider, pre-exposure collider (M-bias), instrument, outcome-only cause — and state the action each role implies, including when selection into the cohort is itself conditioning.
  4. When the DAG is incomplete, apply the empirical criteria (pre-treatment, common cause, disjunctive cause, modified disjunctive cause); and say why change-in-estimate, stepwise significance and prediction-tuned machine learning are the wrong tools for choosing confounders.
  5. Explain collapsibility: why an OR or HR moves on adjustment with no confounding present while an RD or RR does not; distinguish conditional from marginal effects; and describe how standardisation (g-computation) produces a marginal one.
  6. Use Table 1 to describe and diagnose (sparse cells, positivity, label mismatches) rather than to select, and report adjusted results without committing the Table 2 fallacy.
  7. Recognise the four MASLD phenotype groups as a joint exposure, and say what that implies for the adjustment set.

Continuity

The division of labour, stated on Slide 1 and again on Slide 19

Teaches On which data
Tuesday (this lecture) the judgement — which variables, why, and what the effect measure does MASLD (Kueh 2026)
Thursday (L3) the mechanics — Table 1, three GLMs, crude / conditional / marginal, standardisation RHC (right-heart catheterisation, EpiMethods confoundingE)
P2 both, transferred the student’s locked paper

Say this out loud, twice. L3 is not MASLD. It runs on the RHC data, a binary outcome, which is precisely what makes collapsibility visible: the lab estimates one contrast as an OR, an RR and an RD, three ways each. An earlier version of this lecture told students that L3 would build a MASLD Table 1 and fit crude and age-adjusted Cox models; L3 does neither, and a student waiting for MASLD to appear on Thursday loses the first half of the lab.


Frame · 10 minutes across the slides below

Slide 1 — Today’s question, where we are, and the words we will use (6 min)

Slide 2 — The number that moved (4 min)

Part 1 — What question, and what would answer it · 12 minutes across the slides below

EpiMethods Concepts: “The Epistemological Divide”; “The Counterfactual Framework”.

Slide 3 — Explain or predict? (3 min)

Slide 4 — Potential outcomes, three conditions, and why the exposure is tricky (9 min)

Part 2 — Drawing the assumptions · 37 minutes across the slides below

EpiMethods Concepts: “Structural and Knowledge-Based Selection Techniques”; “Simpson’s Paradox”.

Slide 5 — Reading a DAG (6 min)

Slide 6 — Three building blocks, drawn in MASLD (9 min)

Slide 7 — A collider you can see, and paradoxes that are colliders (7 min)

Slide 8 — A working DAG for the locked contrast (10 min) · do not drop

Slide 9 — More roles, and the action each implies (5 min)

Role Structure Adjust? Why
Confounder A ← L → Y Yes closes a back-door path
Proxy of an unmeasured confounder A ← U → Y, U → P Usually yes partly closes it; residual confounding remains
Mediator A → M → Y No, for a total effect removes effect; and if M ← U → Y, opens a collider path
Collider, or its descendant A → C ← U → Y No opens a non-causal path
Pre-exposure collider (M-bias) A ← U1 → C ← U2 → Y No, if it is only that; if it might also confound, adjusting is usually the safer mistake M-bias tends to be small
Instrument Z → A only No removes no bias; widens the CI; can amplify bias from U (Z-bias)
Outcome-only cause R → Y only Optional RD / RR: precision. OR / HR: the number changes (Slide 15)

Part 3 — When the DAG runs out · 8 minutes across the slide below

EpiMethods Concepts: “Empirical Criteria for DAG-Deficient Scenarios”.

Slide 10 — Empirical criteria (8 min)

Candidate Plausibly before the exposure? Cause of WHtR? Cause of death? Modified disjunctive
Age, sex yes yes yes in
Race/ethnicity, income yes plausibly (as proxies for structural factors) yes in
Smoking, physical activity largely yes yes in
Alcohol largely plausibly yes in — and an input to FLI via GGT
T2DM, hypertension, dyslipidaemia, CKD, MI unknown both directions yes cannot be placed
Cancer unknown both directions (weight loss) yes cannot be placed
Medication use follows diagnosis inherits the disease’s problem — cannot be placed

Slide 11 — BREAK (10 min)

Part 4 — How covariates get chosen in practice, and what the effect measure does · 38 minutes across the slides below

EpiMethods Concepts: “Modelling criteria for variable selection”; “Collapsibility and the Choice of Effect Measure”.

Slide 12 — Table 1 describes; it does not select (5 min)

I II III IV
n 391 4,585 787 608
Deaths, n (%) 5 (1.3) 389 (8.5) 74 (9.4) 118 (19.4)
Age, mean 40.1 50.9 49.1 61.5
Female, % 15.3 55.6 14.5 44.9
Type 2 diabetes, % 10.7 27.4 13.9 30.8

Slide 13 — Change-in-estimate (7 min)

Slide 14 — Significance-based and algorithmic selection (4 min)

Slide 15 — Collapsibility (12 min) · do not drop

Stratum (n) Risk, high WHtR Risk, low WHtR OR RR RD
Age ≥ 60 (200) 0.80 0.50 4.00 1.60 0.30
Age < 60 (200) 0.50 0.20 4.00 2.50 0.30
Everyone (400) 0.65 0.35 3.45 1.86 0.30

Slide 16 — Conditional versus marginal, and how to get the marginal one (10 min) · do not drop

Part 5 — Reporting what you estimated · 13 minutes across the slides below

EpiMethods Concepts: “The Table 2 Fallacy”; “Interaction vs. Effect Modification”.

Slide 17 — The Table 2 fallacy: four questions, four DAGs (8 min)

Slide 18 — The four groups are two exposures (5 min)

Part 6 — Thursday · 15 minutes across the slides below

Slide 19 — L3 is RHC, not MASLD (7 min) · do not drop

Slide 20 — Read the 3 × 3, and read 2(e) critically (6 min)

OR RR RD
Crude 1.038 1.019 0.009
Conditional 1.072 1.030 0.013
Marginal 1.058 1.03 0.013

Slide 21 — P2: the same judgement, on your paper (2 min)

Close · 4 minutes

Slide 22 — What adjustment cannot fix; key takeaways; where to read more (4 min)

Slide 23 — References (uncounted)


If you are running behind

Drop or shrink in this order. The first two cost the least.

  1. Slide 7 — paradoxes that are colliders (5 min). Keep the locked-contrast bullet (Group III’s higher TG / GGT) as one sentence on Slide 6.
  2. Slide 18 — the joint exposure (5 → 2 min). Show the figure; say “the adjustment set follows the question” and “effect modification is Week 5”.
  3. Slide 3 — explain or predict (4 min). Fold it into one sentence at the top of Slide 4.
  4. Slide 17 — the Table 2 fallacy (8 → 5 min): show the one-model table and the four DAGs; skip the comparison table. Slide 14 — selection methods (4 → 2 min). Shrink, do not drop: both are core EpiMethods content. Keep the rule one exposure, one model, one row, and confounding is not a significance test plus the post-double-selection pointer.

Never drop Slides 8, 15, 16 or 19. The measurement blend, collapsibility, the conditional / marginal decomposition, and the lab’s real dataset are what Thursday depends on; everything else supports one of the four.

Reading map — each segment and where students can review it

Segment EpiMethods page Key reference
Potential outcomes, DAG grammar (Slides 4–6) confounding0 (video lessons), DAGcodes Greenland, Pearl & Robins 1999; Tennant et al. 2021
Confounder, mediator, collider by simulation confounding1, confounding2, confounding3 —
Simpson’s and birth-weight paradoxes (Slide 7) confounding3b Hernández-Díaz, Schisterman & Hernán 2006
Instruments and Z-bias (Slide 9) confounding4 —
Empirical criteria (Slide 10) confounding0 VanderWeele & Shpitser 2011; VanderWeele 2019
Change-in-estimate (Slide 13) confounding6 —
Stepwise, purposeful selection, ML (Slide 14) confounding0 Heinze, Wallisch & Dunkler 2018
Collapsibility, marginal effects (Slides 15–16) confounding5 Naimi & Whitcomb 2020
Table 2 fallacy (Slide 17) confounding0 Westreich & Greenland 2013
Joint exposure (Slide 18) confounding9 Knol & VanderWeele 2012
L3 (Slides 19–20) confoundingE, confoundingEsolution Zou 2004

Appendix — three DAGs to paste into dagitty.net

Paste each block into the Model code pane at dagitty.net. The “Causal effect identification” panel then gives the adjustment sets each slide states.

Slide 8 — the locked contrast. L stands for age, sex, race/ethnicity, income, smoking and physical activity; Blend is the composite comorbidity indicator. With Before and After latent, dagitty reports that no adjustment set exists; remove Before’s latent tag and it returns {Before, L}.

dag {
  WHtR [exposure]
  Death [outcome]
  Before [latent]
  After [latent]
  L -> WHtR
  L -> Death
  L -> Before
  Before -> WHtR
  Before -> Death
  Before -> After
  WHtR -> After
  After -> Death
  WHtR -> Death
  Before -> Blend
  After -> Blend
}

Slide 17 — the Table 2 fallacy, four questions on one DAG. Set each variable in turn as the exposure (click it, then “exposure”): - Obese — dagitty returns {Age}; - Waist — {Age, Obese}; - Age — the empty set; - Dm (diabetes) — no set, because U (genetic risk) is latent.

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

Slide 19 — L3 with selection on having an ADL score. L stands for the measured covariates. Click ADLrec to condition on it and watch RHC → ADLrec ← U → Death open.

dag {
  RHC [exposure]
  Death [outcome]
  U [latent]
  L -> RHC
  L -> Death
  U -> RHC
  U -> Death
  U -> ADLrec
  RHC -> ADLrec
  RHC -> Death
}

References