Re: [R] A question on time-dependent covariates in the Cox model.

From: Peter Dalgaard <>
Date: Wed 22 Jun 2005 - 20:34:46 EST

"Marianne dk" <> writes:

> I have a dataset with
> event=death
> time (from medical examination until death/censoring)
> dose (given at examination time)
> Two groups are considered, a non-exposed group (dose=0), an exposed group
> (dose between 5 and 60).
> For some reason there is a theory of the dose increasing its effect over
> time (however it was only given (and measured) once = at the time of
> examination).
> I tested a model:
> coxph(Surv(time,dod)~dose + dose:time)
> Previously I tested the model in SAS:
> proc phreg data=test;
> model time*dod(0)=dose dosetime /rl ties=efron;
> dosetime=time*dose;

> run;
> Without the interaction terms I get the same results for the two models. By
> including the interaction terms I do not. The model in R gives a negative
> coefficient for the interaction term which is expected to be positive (and
> is so in SAS). The LRTs are also completely different.
> 1) Is it reasonable to bring in an interaction term when dose is only
> measured once?
> 2) If yes, can anyone give a hint on explaining the difference between the
> models in R and SAS?

I don't know what SAS does, maybe it second-guesses your intentions, but R will definitely get it completely wrong. If you use time as a covariate, the same time (of death/censoring) will be applied at all death times. Pretty obviously, long observation times tend to be associated with low mortalities! With interactions you get, er, similarly incorrect effects.

To do coxph with time-dependent variables, you need to split data into little time segments, according to the death time of every death, inserting a new variable (ntime, say) which is the time of the endpoint of the interval.

   O__  ---- Peter Dalgaard             ุster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph: (+45) 35327918
~~~~~~~~~~ - (                  FAX: (+45) 35327907

______________________________________________ mailing list
PLEASE do read the posting guide!
Received on Wed Jun 22 20:37:46 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:56 EST