Skip to main content

CAUSALab

CAUSALab generates, repurposes and analyzes health data so that key decision makers – regulators, clinicians, policy makers and you – can make more informed decisions.

Software

CAUSALab is committed to offering free tools, code, and events to make causal inference more accessible. If you’d like to support our work at Harvard T.H. Chan School of Public Health, consider making a financial contribution.  

The g-formula (Robins, 1986) uses data with time-varying treatments and confounders to estimate the risk or mean of an outcome under hypothetical treatment strategies specified by the user. The software below implements a plug-in estimator of the non-iterative conditional expectation (NICE) representation of the g-formula.

  • R – gfoRmula package
  • SAS – GFORMULA macro
  • SAS – GFORMULA_RCT macro to estimate the per-protocol effect in randomized trials with protocol deviations
  • Python – pygformula package

This software implements a plug-in estimator of the iterative conditional expectation (ICE) representation of the g-formula, with a choice between both singly robust and multiply-robust estimators.

  • SAS – MSM macros to estimate the parameters of a marginal structural Cox model and estimate risk under hypothetical static interventions (requires SAS IML)
  • SAS – Sample program to estimate the parameter of a marginal structural Cox model. An earlier version of this program appeared in the appendix of Hernán, Brumback, and Robins (2000). This article shows how to use STATA to do the same thing.
  • SAS – SNCFTM macro implements g-estimation of the parameters of a Structural Nested Cumulative Failure Time Model, and estimation of risk under a hypothetical static intervention on a binary time-varying treatment as described by Picciotto et al. Structural Nested Cumulative Failure Time Models to Estimate the Effect of Hypothetical Interventions. JASA 2013
  • SAS –Sample program to simulate data from a Structural Nested Accelerated Failure Time Model as described by Young et al.
  • R – SNCTM R function implements g-estimation of the parameters of a Structural Nested Cumulative Failure Time Model using an instrumental variable, and estimation of marginal cumulative risks under a hypothetical static treatment regime as described by Shi et al., BMC Medical Research Methodology 2021.
  • SAS – IV_BOUNDS macro provides bounds for the average treatment effect of a binary treatment as described by Swannson et al. Partial identification of the average treatment effect using instrumental variables. JASA 2018; 113(522):933-947.