[R] time dependency of Cox regression

Thomas Lumley tlumley at u.washington.edu
Wed Nov 3 19:38:48 CET 2004


On Wed, 3 Nov 2004, array chip wrote:

> Thanks very much for the suggestion. still some
> quiestions. In your example of splitting the covariate
> into 6 time-dependent covariates (6 records per
> person), will the survival time and censored status be
> the same for each of the 6 records? If that's the
> case, how does the model know that each of the 6
> time-dependent covariates corresponds to 6 consecutive
> time points?

No, it won't.  This is what survSplit handles.  If someone dies in the 
middle of year 4 they will have records

start stop event
0      1    0
1      2    0
2      3    0
3      4    0
4      4.5  1

and no record for subsequent years

> I am thinking about create a dummy factor variable
> called "time" to indicate which time interval each
> patient's survival time is in. For example, if a
> patient's survival time is less than 2 years, then the
> dummy variable is 2, and so on for each patient. Then
> I specify a covariate x time interaction term in the
> Cox regression. I would assume the Cox regression will
> return a separte hazard ratio for each level of the
> dummy factor variable which corresponds to the hazard
> ratio of each year. Is this a reasonable way to do it?

No. This doesn't work unless you also split the records.  The problem is 
that the person is labelled as dying in year 2 at every time point, but 
you only want to change the risk during year 2.


It is quite possible in principle to allow for arbitrary functional time 
dependence in a Cox model, but the R implementation doesn't.  I have an 
implementation that does, but it's in Xlispstat.

 	-thomas




More information about the R-help mailing list