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]

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

From   Adam Olszewski <>
To   "" <>
Subject   Re: st: Plotting results from Cox regression with a time-varying covariate
Date   Mon, 1 Apr 2013 18:08:22 -0400

I would suggest using a flexible parametric model (-stpm2- command, available from SSC), which can predict survival from the model easily and is not scared of interactions with time. The regression coefficients will be likely close to identical to your Cox model. 
You will obviously need to specify the values of all covariates to do a specific prediction, though you can also play with the meansurv option which will calculate an "average" curve for your population. 
stpm2 has a little learning curve to it, which pays off with a dramatically richer survival analysis, particularly for large epidemiological datasets. 

Sent from my iPhone

On Apr 1, 2013, at 5:56 PM, Erik Voeten <> wrote:

> 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:
> *
> *
> *

*   For searches and help try:

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