Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Plotting results from Cox regression with a time-varying covariate


From   Erik Voeten <ev42@georgetown.edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: Plotting results from Cox regression with a time-varying covariate
Date   Mon, 1 Apr 2013 17:56:14 -0400

I am trying to create a graph that illustrates the substantive effect
of a treatment variable interacted with time in a survival (Cox
model). The Kaplan-Meier curves show clearly that the hazards are
non-proportional so I interact with time. I would like to show that
after controlling for a confounder, the differences between the
treated and non-treated group change.

I have a binary treatment T and a confounder X that I also interact
with time. The model is easily estimated with the tvc option in stcox.

What I would then like to do is

stcurve survival, at1(T=0) at2(T=1)

But stcurve and other post-estimation commands don't like models
estimated with the tvc option. So I have split up the data at failure
times creating the "long data" and estimate the interactions with time
explicitly. I have done this but I still haven't been able to trick
margins and marginsplot into giving me something similar to what the
stcurve would yield (I can get stcurve to plot the parallel curves but
not to include the interaction with time. I can get a graph of the
relative hazards, which I know is appropriate in cox models but not
appreciated in my field. Any tips to get survival probabilities? I
have searched the STATAlist archives but haven't found an answer.
There must be a manual solution using pred and twoway graphs but I was
hoping to use marginsplot.

best, Erik.
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index