Skip to contents

Data and ground truth

Simulate the confounded cohort, read the randomised truth, and look up variables.

simulate_hr_agent()
Simulate the heart-rate-lowering-agent cohort
oracle_hr()
Ground-truth hazard ratio from a randomised "oracle" trial
hr_variables()
Data dictionary for the simulated cohort

Causal structure

The DAG behind the simulation.

hr_dag()
The causal DAG behind the simulation
plot_dag()
Draw the teaching DAG

Weighting and models

Propensity model, IPT weights, and the M1-M7 model sequence.

fit_propensity()
Fit the propensity (treatment) model
add_iptw()
Add propensity scores and inverse-probability-of-treatment weights
fit_all_models()
Fit the full teaching sequence M1–M7
hr_term()
Hazard ratio (95% CI) for a single exposure coefficient
hr_msm()
Always-treat vs never-treat hazard ratio from a two-dose (marginal) model

Forest plot

Assemble and draw the method comparison.

build_forest()
Assemble the forest table from the fitted models
forest_labels()
Default labels for the M1–M7 forest
plot_forest()
Forest plot of the model comparison against the ground truth
msm_palette()
BioCE teaching colour palette