Home  >>  Archives  >>  Volume 11 Number 4  >>  st0238

The Stata Journal
Volume 11 Number 4: pp. 479-517



Subscribe to the Stata Journal
cover

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

Rhian M. Daniel
Centre for Statistical Methodology
London School of Hygiene and Tropical Medicine
London, UK
[email protected]
Bianca L. De Stavola
Centre for Statistical Methodology
London School of Hygiene and Tropical Medicine
London, UK
Simon N. Cousens
Centre for Statistical Methodology
London School of Hygiene and Tropical Medicine
London, UK
Abstract.  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.
Terms of use     View this article (PDF)

View all articles by these authors: Rhian M. Daniel, Bianca L. De Stavola, Simon N. Cousens

View all articles with these keywords: gformula, causal inference, g-computation formula, time-vary-ing confounding, mediation, direct and indirect effects

Download citation: BibTeX  RIS

Download citation and abstract: BibTeX  RIS