An R Package for G-estimation of Structural Nested Mean Models
Bibliographic record
Abstract
To the Editor: Structural nested mean models are a useful tool when estimating the effect of time-varying treatments, a challenge made more difficult by the presence of treatment-dependent confounders. We consider the situation where data are measured on, and a treatment assigned to, subjects at a number of distinct time points (or stages). We wish to identify the effect of treatment at each stage on a final (continuous) outcome, when all time-varying confounders are correctly measured, with each treatment’s effect characterized by a structural nested mean model. For example, consider a study of the effect of activity level (the treatment) on blood pressure (the outcome), with data collected by repeated questionnaires over time. We might expect activity level to be associated with blood pressure, but other factors such as age or body mass index may interact with treatment, potentially obfuscating its effect. A structural nested mean model to model the treatment effect may take such interactions into account. G-estimation1 is an estimating equation-based approach used to estimate the parameters of structural nested mean models (but has wider applications). Despite theoretical advantages over alternative approaches,2–5 it has seen relatively little use, thanks to its typically strongly theoretical presentation and challenging implementation. We have therefore derived simplified theory, reducing G-estimation to straightforward matrix equations, and produced an accompanying R package DTRreg.6 Theoretical details are included as Supplementary Material (https://links.lww.com/EDE/B132). We demonstrate G-estimation and DTRreg with a simulation study; a real data analysis is included in the Supplementary Material (https://links.lww.com/EDE/B133). We consider a three-stage example with binary treatments at stages 1 and 3, continuous treatment at stage 2, and treatment–covariate interaction: Stage 1. Covariate: ; treatment: ; Stage 2. Covariate: ; treatment: ; Stage 3. Covariate: ; treatment: ; and Outcome: where for simplicity, we set all parameters equal to 1. Treatment effects are therefore characterized by structural nested mean models , and we seek estimates for and , so that the effect of assigning a patient with covariate the treatment aj is estimated by . In addition, at each stage, we consider a treatment-free model, characterizing the expected outcome assuming no treatment (aj = 0) at that and all subsequent stages (denoted Gj): Stage 1: ; Stage 2: ; and Stage 3: . Our final component is the treatment model: the expected value of treatment given prior information. At stages 1 and 3 (binary treatment), we estimate this via logistic regression, at stage 2 (continuous treatment), we use linear regression. G-estimation for such an analysis boasts the double-robustness property: our structural nested mean model parameter estimators at each stage are consistent if at least one of the treatment or treatment-free models is correctly specified. To demonstrate, we conduct our analysis with a misspecified treatment-free model at stage 3, a misspecified treatment model at stage 2, and both models misspecified at stage 1. Misspecification is achieved by omitting all covariates from the affected models. Stage 1 (both misspecified). Treatment: (fit by logistic regression) Treatment-free: ; Stage 2 (treatment model misspecified). Treatment: (fit by linear regression) Treatment-free: ; Stage 3 (treatment-free model misspecified). Treatment: (fit by logistic regression) Treatment-free: . We can estimate the structural nested mean model parameters at each stage in a step-by-step fashion, either manually through matrix equations (eAppendix; https://links.lww.com/EDE/B134), or through our R package (Figure). Analyzing 1,000 datasets of size n = 1,000, we obtain mean estimates , , and at stages 1, 2, and 3, respectively. As expected, the estimators appear consistent when either the treatment or treatment-free model was correctly specified (stages 2 and 3), but not when both were misspecified (stage 1). Inference may be pursued by either the bootstrap or sandwich-based approaches.FIGURE: G-estimation using our R command (for full details see eAppendix [https://links.lww.com/EDE/B134]; note that “blip” is an alternate name for our structural nested mean model).Structural nested mean models are a valuable, but underused, alternative to more established modeling techniques, with G-estimation one approach for parameter estimation within this framework. Through simplified theory, or our computational routine, G-estimation may be implemented with ease, and we encourage practitioners to consider its use in future analyses. ACKNOWLEDGMENT The authors thank the National Heart, Lung, and Blood Institute for allowing access to data from the Honolulu Heart Program. Michael P. Wallace Erica E. M. Moodie Department of Epidemiology, Biostatistics and Occupational Health McGill University Montreal, QC, Canada [email protected] David A. Stephens Department of Mathematics and Statistics McGill University Montreal, QC, Canada
Fetched live from OpenAlex and de-inverted. Abstracts are not stored in this database: the inverted indexes are 8.6 GB of the frame’s 9.3 GB of text, and the host has 13 GB free.
How this classification was reachedexpand
Full frame distilled prediction
Teacher imitationNot calibrated prevalence, not ground truth. Human validation pending. Learned from the 10,348 direct Codex labels and 10,348 direct Gemma labels. Candidate is the union of thresholded teacher heads; consensus is their intersection. These outputs are machine_predicted_unvalidated and are not human labels or direct frontier model labels.
Codex and Gemma teacher scores by category
| Category | Codex | Gemma |
|---|---|---|
| Metaresearch | 0.001 | 0.005 |
| Meta-epidemiology (narrow) | 0.000 | 0.000 |
| Meta-epidemiology (broad) | 0.001 | 0.000 |
| Bibliometrics | 0.000 | 0.000 |
| Science and technology studies | 0.000 | 0.000 |
| Scholarly communication | 0.000 | 0.000 |
| Open science | 0.000 | 0.000 |
| Research integrity | 0.001 | 0.001 |
| Insufficient payload (model declined to judge) | 0.000 | 0.000 |
Machine scores (provisional)
The two teacher heads of the student model, read on this work. A score orders the frame for review; it never asserts a category, and the validation status ships verbatim with every row.
Baseline scores from an immature model (maturity gate not passed, 7 training rounds). Scores rank; they never assert a category.
score_only:v0-immature-baseline · verbatim from the scoring run: score_only means the number may rank works, and no category label ships from itClassification
machine, unvalidatedMachine predicted; a candidate call from one teacher head, not a consensus.
How this classification was reached, model by model and score by score, is at the end of the page under "How this classification was reached".