[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Stata in Marginal Structural Models survival analysis

From   Michael McCulloch <>
To   Statalist <>
Subject   st: Stata in Marginal Structural Models survival analysis
Date   Fri, 13 Jul 2007 08:31:31 -0700

Dear readers
I have read with great interest the paper Fewell, Z., M. A. Hernan, et al. (2004). "Controlling for time-dependent confounding using marginal structural models." The Stata Journal 4(4): 402-20, in which causal inference for survival at time(T) is estimated using logistic regression.

In my case, I am hoping to find do-file examples showing how to implement the MSM-adjusted hazard ratio using dates of treatment and death. Specifically, I have hit two stumbling blocks:
(1) the _stset_ command cannot incorporate the weights generated using logistic regression Inverse Probability of Treatment Weighting.
(2) the bootstrap appears to not be correctly specified.

treatment (y/n) = tcm
event = failed
date of treatment = datedx
date of death = datedied

My code is:
*estimate probability of treatment
predict p_tcm_ALL
gen p_notcm_ALL = 1-p_tcm_ALL if tcm==0
replace p_tcm_ALL =p_notcm_ALL if tcm==0

*create stabilized weight==P(A)/P(A|W)
logit tcm
predict p_ALL
gen p_noALL=1-p_ALL if tcm==0
replace p_ALL = p_noALL if tcm==0
gen wt_stab_ALL=p_ALL/p_tcm_ALL

* MSM Cox, stabilized weights
stset datedied [iweight=wt_stab_ALL], failure(failed) origin(datedx)

bootstrap, reps(1000): stcox tcm

Thank you,


Michael McCulloch
Pine Street Foundation
124 Pine St., San Anselmo, CA 94960-2674
Tel: (415) 407-1357
Fax: (415) 485-1065
* For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index