[R] survfit with newdata and individual=TRUE

Chris Adolph cadolph at u.washington.edu
Mon Apr 17 00:05:59 CEST 2006


I'm using the survfit() function with the Cox proportional hazards model, 
and having trouble producing fitted survivor curves when I ask survfit to 
use newdata recorded over multiple periods for the same individual.  I'm 
using the counting process formulation, as I have time-varying covariates.

For example,

cph.m1 <- coxph(Surv(time=sdatenrm, time2=edatenrm, event=censor)~age)

xhyp <- list(age=c(50,60),
              sdatenrm=c(1,20),
              edatenrm=c(21,40),
              censor=c(0,1)
              )

survfit(cph.m1,newdata=xhyp,conf.int=.95,individual=FALSE)

works fine, but then running

survfit(cph.m1,newdata=xhyp,conf.int=.95,individual=TRUE)

gives this error message:

Error in temp[, 1] : incorrect number of dimensions

Is there something wrong with the way I'm giving survfit() newdata?

Thanks,

Chris Adolph

_____________________________________________
Christopher Adolph
Assistant Professor of Political Science
Center for Statistics and the Social Sciences
Box 354320
University of Washington
Seattle, WA 98195-4320
cadolph at u.washington.edu
www.chrisadolph.com




More information about the R-help mailing list