L4 interaction

Lab 4: Effect Modification & Interaction

Overview

In this lab you will work through effect modification and interaction using the RHC dataset, investigating whether the effect of right-heart catheterization on mortality is modified by a patient’s Do-Not-Resuscitate (DNR) status. You will prepare an analysis-ready dataset, fit logistic regression models with a product term (the multiplicative scale), and calculate the Relative Excess Risk due to Interaction (RERI), Attributable Proportion (AP) and Synergy Index (SI) — all three on the additive scale. Your TA will walk through the worked solution during the session.

These are the questions you will ask in P3 on your own locked paper. If your paper’s outcome is time-to-event, use Tuesday’s time-to-event tools rather than this lab’s logistic recipe.

Materials

Before you come to lab, install the two packages this exercise needs:

install.packages(c("interactionR", "Publish"))

Note the capital P in Publish — the CRAN package is capitalised even though the function you call is lowercase publish().

Things to know about the exercise before you read its output:

Your task

  1. Follow along as the TA explains the worked solution.

  2. Run the R Markdown file yourself, as a group, on your own laptop.

  3. Put your group name and the first names of everyone present in the author: field at the top of the file.

  4. Add sessionInfo() in a final code chunk.

  5. Knit to PDF or HTML and submit that one file before the lab ends.

No written explanations are required. If you get stuck, ask the TA in the room — that is what the session is for.

Deliverable

Grading: Complete / Incomplete

You receive Complete if the document knitted without errors, your group name and members are in it, and it was submitted before the lab ended. Only members present in the room receive credit.


Where this lab fits

This lab is one step in a weekly chain: Tuesday’s lecture sets up the method, Thursday’s lab runs it on fixed teaching data, and your increment applies it to the paper your group locked at M0.

Document How this lab connects
This week’s lecture Week 5 — Interaction and effect modification Tuesday separated effect modification from interaction on a clean smoking × income example, then stress-tested both on the paper’s four groups (obesity × waist fat): each question has its own adjustment set, each scale its own answer, and every cell gets counted first. This lab does both questions on a binary outcome, where logistic regression is the right tool: Problem 1 is effect modification (RHC’s confounders only), Problem 2 is interaction (the confounders of both).
Slide deck Week 5 deck The same material as slides, with speaker notes. Press S for notes, F for fullscreen.
Your increment P3 — Effect modification Run one pre-specified effect-modification test on your own paper’s exposure, and state the verdict as evidence rather than as a mechanism: what the data show at the precision you have, and what the interval leaves open.
Worked example P3 example — its code A completed P3, including how the verdict is worded when the interval is wide. That wording is the hard part, not the arithmetic.
Milestone M1 — Replication and interrogation P3 enters M1 as Effect modification. P3 is optional and ungraded with nothing to submit; M1 is where it is assessed.