[R] Problem of COX model with time dependent covariate

David Winsemius dwinsemius at comcast.net
Mon Dec 26 13:49:33 CET 2011

On Dec 26, 2011, at 3:02 AM, JiangGZ wrote:

> Hi all,
> I am trying to detect association between a covariate and a disease  
> outcome using R. This covariate shows time-varying effect, I add a  
> time-covariate interaction item to build Cox model as follows:
> COX <- coxph(as.formula("Surv(TIME,outcome)~eGFR_BASE 
> +eGFR_BASE:TIME"),ori.data);
>                           coef   exp(coef)   e(coef)        z   p
> eGFR_BASE                 6.40     603.5133     0.3702    17.3   0
> eGFR_BASE:TIME -3.41      0.0329     0.0772   -44.2   0
> But the result seems very different from that got by SPSS:
>                    B    SE    	Wald	    df    	Sig.	    Exp(B)
> eGFR_BASE       -13.603	  .548	  616.007	   1	     .000    	.000
> T_COV_*eGFR_BASE .860 	.115	  55.859  	1	  .000	        2.362
> so my questions are :
> 1, Is it correct to deal with time dependent covariate in Cox  
> regression using R? if not, how to do it ?

The usual way to represent time dependent covariates is to set up  
records with start and stop time and use the Surv(time, time2, event)  
usage. This is clearly described in the help page and there is  
vignette describing time-dependent covariate methods in the package  

> 2, How T_COV_ was calculated in SPSS, and is it the same with the  
> survival time?

How could we possibly know how _you_ calculated T_COV? (And this is  
very definitely the wrong mailing list for that question.)

The description in the IBM/SPSS documentation says using the time  
variable on the RHS is used for testing non-proportionality of hazards  
rather than for investigating the association of a covariate with an  


The SPSS documentation appears designed to lead the naive user into an  
incorrect model formulation, since the only example of use with its  
dialog box shows the user setting up the test for non-proportionality.  
Given that you proposed using a time variable on the RHS in an R  
formula, I am guessing you also do not know how to properly use SPSS  
for the purposes you intend.


> Many thanks.
> GZ
> 	[[alternative HTML version deleted]]
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
West Hartford, CT

More information about the R-help mailing list