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 on April 23, and its replacement, 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 <>
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:

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