[R] Cox model

Terry Therneau therneau at mayo.edu
Wed Feb 13 13:59:21 CET 2008


 What you appear to want are all of the univariate models.  You can get this 
with a loop (and patience - it won't be fast).
 
ngene <- ncol(genes)
coefmat <- matrix(0., nrow=ngene, ncol=2)
for (i in 1:ngene) {
	tempfit <- coxph(Surv(time, relapse) ~ genes[,i])
	coefmat[i,] <- c(tempfit$coef, sqrt(tempfit$var))
	}


  However, the fact that R can do this for you does not mean it is a good idea.  
In fact, doing all of the univariate tests for a microarray has been shown by 
many people to be a very bad idea.  There are several approaches to deal with 
the key issues, which you should research before going forward.
  
  Terry Therneau



More information about the R-help mailing list