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


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

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


From   Steve Samuels <sjsamuels@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: margins after stcox with time-dependent covariate
Date   Thu, 7 Mar 2013 12:53:50 -0500

Correction: -stcurve- after -stcox- _can_ plot smoothed estimates of
the hazard function. I prefer -stpm2- because of it has 
more flexible models for non-proportional hazards.


Steve


On Mar 6, 2013, at 11:05 AM, Steve Samuels wrote:


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/


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