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, **statalist.org** is already up and running.

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

From |
Steve Samuels <sjsamuels@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: margins after stcox with time-dependent covariate |

Date |
Wed, 6 Mar 2013 11:05:56 -0500 |

Mario Petretta asked about -margins- after -stcox-. Maarten (http://www.stata.com/statalist/archive/2013-03/msg00000.html) stated that -margins- after -stcox- can deal with quantities related to the estimated hazard ratios. This is because -margins- operates on e(b). He recommends -stpm2-, but, -margins- after -stpm2- cannot operate on all functions of the baseline hazard. For example, . margins i.x, predict(meansurv) works, but . margins i.x, predict(hazard) does not. I agree with Maarten that -stpm2- is preferable to -stcox- for computing descriptive statistics for a survival distribution. Notably, -stpm2- has a -predict, hazard - command with at() options. I recommend that Mario use these to describe the two-way interaction in his model. He will need to center remaining variables and also use the "zero" option. For time-dependent covariates. I think that the plotted hazard function is the only useful descriptive summary. (Hazard ratios are comparative summaries). The survival function starting from time 0 is not descriptive when covariate values change. What would the curve S(t| X(t)= c ) describe? It would describe survival only for a population for whom the value of X was C throughout. Data with time-dependent covariates is multiple record data. -stcox- has a cluster(id) option that ensures correct standard errors for such data, but-stpm2- does not. An earlier version, -stpm- by Patrick Royce (from SSC), does have the cluster option, so Mario should use that for estimating standard errors. Like -stpm2-, -stpm- has a tvc() option for estimating time-varying-coefficients of some variables. This is useful for checking for non-proportionality. The algorithm in -stpm2- is more flexible than that in -stpm-, so I would do the check with -stpm2-. One other point: Mario -stsplit- at failures. This works for -stcox- because only values at failures are relevant. But it will not work for -stpm- or -stpm2-, which require the exact times of change for time-dependent covariates. The last example in the Manual entry for -stset- shows how to prepare this kind of data. There is also a Stata Tip by Ben Jann: Stata tip 8: Splitting time-span records with categorical time-varying covariates. The Stata Journal (2004), 4, Number 2, pp. 221–222. This can be downloaded for free. Steve * * 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/

**Follow-Ups**:**Re: st: margins after stcox with time-dependent covariate***From:*Steve Samuels <sjsamuels@gmail.com>

- Prev by Date:
**st: Regression discontinuity with interrupted time series** - Next by Date:
**Re: st: spreg gs2sls** - Previous by thread:
**Re: st: margins after stcox with time-dependent covariate** - Next by thread:
**Re: st: margins after stcox with time-dependent covariate** - Index(es):