Dear all,

I am confused with the behaviour of survfit with newdata option.

I am using the latest version R-2-15-0. In the simple example below I am 
building a coxph model on 90 patients and trying to predict 10 patients. 
Unfortunately the survival curve at the end is for 90 patients. Could somebody 
please from the survival package confirm that this behaviour is as expected or 
not - because I cannot find a way of using 'newdata' with really new data. 
Thanks in advance. DK

> x<-matrix(rnorm(100*20),100,20)

>
time<-runif(100,min=0,max=7)

>
status<-sample(c(0,1), 100, replace = TRUE)  
> trainX<-x[11:100,]  
>
trainTime<-time[11:100]  
>
trainStatus<-status[11:100]  
>
testX<-x[1:10,]  
> coxph.model<-
coxph(Surv(trainTime,trainStatus)~ trainX)  
> sfit<- survfit(coxph.model,newdata=data.frame(testX))

>
dim(sfit$surv)

[1] 90 90


                                          
        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to