Comparison of methods of adjusting for time-varying confounding under misspecification – A Monte-Carlo simulation study
Stata and R Analysis Code
This repository contains the Stata and R code used in the misspecification simulation by Clare et al. 2019
The Stata code creates a series of quasi-random datasets using a pre-specified data structure. Analysis code runs all analyses on those datasets, and saves the results. Note that the code is written to run on Google Compute clusters, using a Linux OS (in order to run the syntax on a Windows-based machine, some changes to the way parallel processing is required (because Windows is not compatible with ‘FORK’).
Two types of standard error estimates were used, so two sets of analysis code are included. The first calculates standard errors using bootstrapping. The second calculates model-based standard errors, using influence curves for TMLE.
|Description||Github code||Download code|
|S1 - Data creation Stata Code||Data creation code||Download code|
|S2 - Analysis with bootstrap SEs - R Code||Analysis code - Bootstrap||Download code|
|S3 - Analysis with model-based/influence curve SEs - R Code||Analysis code - Alternative||Download code|
- Comparison of methods of adjusting for time-varying confounding with missing data – A Monte-Carlo simulation study
- The association between alcohol use and pain in people with chronic non-cancer pain prescribed pharmaceutical opioids – a prospective cohort study
- The overall effect of parental supply of alcohol across adolescence on alcohol-related harms in early adulthood – a prospective cohort study
- Targeted Maximum Likelihood Estimation to adjust for time-varying confounding – a tutorial paper
- Causal models adjusting for time-varying confounding—a systematic review of the literature