This repository contains code used to fit history adjusted marginal structural Cox models with a time-to-event outcome. We use this model to estimate the risks to cardiovascular and thromboembolic events (CTE) caused by exposure to fine particulate matter (PM2.5) and either corticosteroids (Steroids) or Anticoagulants (Anticoagulants) among high-risk older adults enrolled in Medicare.
Detailed descriptions of the various scripts are available within their respective folders. The R files in the root directory contain the necessary functions for constructing the inverse probability weights and for evaluating additive interactions with either a Cox proportional hazards model or an Aalen additive hazards model.
interaction.R Functions for evaluating additive and multiplicative interactions.
ipw_fun.R Functions for generating inverse probability weights (with Random Forest, XGBoost, or GEE).