Instructor: Kuan Liu, University of Toronto
Date: May 30, 2026
Duration: 50 minutes
Bayesian methods offer several practical advantages for causal inference: they provide a natural way to quantify uncertainty in causal effect estimates and allow us to assess sensitivity to violations of key causal assumptions. Despite these advantages, Bayesian causal inference remains underused in practice and is rarely covered in introductory causal inference courses.
This workshop bridges that gap and is suitable for anyone with familiarity with regression and Bayesian modeling. No prior exposure to causal inference is required.
Working through simulated and real data examples in R, we cover:
- Bayesian g-computation
- Bayesian propensity score weighting
- Bayesian marginal structural models for time-varying treatments
- Bayesian sensitivity analysis for unmeasured confounding (latent variable approach)
- Bayesian causal forests for heterogeneous treatment effects (time permitting)
.
├── bayesian_causal_workshop.qmd # Quarto slide deck (revealjs)
├── index.qmd # Workshop index page
├── style.css # Custom CSS for slide formatting
├── workshop_code.R # Standalone R code
├── continuous_outcome_data.csv # Simulated longitudinal data
├── figures/ # Output plots (generated by running R scripts)
├── 2026CSSC_BayesianCausal.Rproj # RStudio project file
└── README.md # This file
Used for all point-treatment examples (Parts II, IV, V).
- Source: Connors et al. (1996), publicly available at https://hbiostat.org/data/repo/rhc.csv
- N: 5,735 critically ill ICU patients
- Treatment: Right heart catheterization in first 24 hours (
swang1) - Outcomes: 30-day mortality (
death), hospital length of stay - Confounders: Age, sex, race, disease category, vital signs, lab values
The data is loaded directly from the URL in the R script — no download needed.
Used for the time-varying treatment example (Part III).
- N: 1,000 subjects, 2 visits
-
Variables: Baseline covariates (
w1,w2), time-varying confounders (L1_1,L2_1,L1_2,L2_2), binary treatments (a_1,a_2), continuous outcome (y) -
Causal estimand: ATE of always treated (
$\bar{a}=1$ ) vs never treated ($\bar{a}=0$ )
| Part | Method | R Package | Outcome | Time-varying |
|---|---|---|---|---|
| II | Parametric Bayesian g-computation | rstanarm |
Binary | No |
| II | Nonparametric Bayesian g-computation (BART) | BART |
Binary | No |
| II | Bayesian propensity score weighting | rstanarm |
Binary | No |
| III | Bayesian marginal structural model | bayesmsm |
Continuous | Yes |
| IV | Bayesian sensitivity analysis (latent |
rstan |
Binary | No |
| V | Bayesian causal forests (CATE) | bcf |
Binary | No |
install.packages(c(
"tidyverse",
"rstanarm",
"rstan",
"BART",
"bcf",
"bayesmsm",
"gtools"
))Note on
rstan: If you have not used Stan before, follow the RStan Getting Started guide to configure your C++ toolchain before installing.
git clone https://github.com/Kuan-Liu-Lab/2026CSSC_BayesianCausal.git
cd 2026CSSC_BayesianCausalOpen the project by double-clicking 2026CSSC_BayesianCausal.Rproj in RStudio. This sets the working directory automatically so all file paths resolve correctly.
source("workshop_code.R")- Oganisian, A. & Roy, J.A. (2021). A practical introduction to Bayesian estimation of causal effects: Parametric and nonparametric approaches. Statistics in Medicine, 40(2), 518–551.
- Oganisian, A. (2026). Bayesian sensitivity analyses in causal inference. arXiv:2602.23640.
- Saarela, O. et al. (2015). On Bayesian estimation of marginal structural models. Biometrics, 71(2), 279–288.
- Liu, K. et al. (2020). Estimation of causal effects with repeatedly measured outcomes in a Bayesian framework. Statistical Methods in Medical Research, 29(9), 2507–2519.
- Hahn, P.R., Murray, J.S., & Carvalho, C.M. (2020). Bayesian regression tree models for causal inference: Regularization, confounding, and heterogeneous treatment effects. Bayesian Analysis, 15(3), 965–1056.
- Chipman, H.A., George, E.I., & McCulloch, R.E. (2010). BART: Bayesian additive regression trees. Annals of Applied Statistics, 4(1), 266–298.
- Rubin, D.B. (1981). The Bayesian bootstrap. Annals of Statistics, 9(1), 130–134.
- Connors, A.F. et al. (1996). The effectiveness of right heart catheterization in the initial care of critically ill patients. JAMA, 276(11), 889–897.
This workshop material is made available for educational purposes.
© 2026 Kuan Liu, University of Toronto.