gformula: Estimating causal effects in the presence of time-varying confounding or mediation using the g-computation formula

This article describes a new command, gformula, that is an implementation of the g-computation procedure. It is used to estimate the causal effect of time-varying exposures on an outcome in the presence of time-varying confounders that are themselves also affected by the exposures. The procedure also addresses the related problem of estimating direct and indirect effects when the causal effect of the exposures on an outcome is mediated by intermediate variables, and in particular when confounders of the mediator–outcome relationships are themselves affected by the exposures. A brief overview of the theory and a description of the command and its options are given, and illustrations using two simulated examples are provided.

Issue Date:
Publication Type:
Journal Article
DOI and Other Identifiers:
st0238 (Other)
PURL Identifier:
Published in:
Stata Journal, Volume 11, Number 4
Page range:
Total Pages:

Record appears in:

 Record created 2017-04-01, last modified 2017-04-28

Download fulltext

Rate this document:

Rate this document:
(Not yet reviewed)