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

Peter Dalgaard p.dalgaard at biostat.ku.dk
Wed Jun 22 12:34:46 CEST 2005


"Marianne dk" <m_323stat at hotmail.com> 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.
> 
> TWO QUESTIONS:
> 
> 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
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907




More information about the R-help mailing list