Re: [R] expected risk from coxph (survival)

From: Reid Tingley <r_tingley_at_hotmail.com>
Date: Sat, 07 Jun 2008 17:43:09 -0300

Thanks to Dieter Menne for suggesting cph in the Design package. I had been looking at cph, but I can't seem to find an analog to the "expected" argument in the survival package. Am I missing something? I am using R 2.6.1 and Windows XP. Cheers,Reid> To: r-help_at_stat.math.ethz.ch> From: dieter.menne_at_menne-biomed.de> Date: Sat, 7 Jun 2008 08:15:48 +0000> Subject: Re: [R] expected risk from coxph (survival)> > Reid Tingley <r_tingley <at> hotmail.com> writes:> > When I try to to obtain the expected risk for a new dataset using coxph in the> survival package I get an error.> > Using the example from ?coxph:> > # Example rewritten by DM; please do not use HTML mail> library(survival)> test1 <- list(time= c(4, 3,1,1,2,2,3),> status=c(1,NA,1,0,1,1,0),> x= c(0, 2,1,1,1,0,0),> sex= c(0,0,0,0,1,1,1))> cox<-coxph( Surv(time, status) ~ x + strata(sex), test1) #stratified model> new<-list(time= c(5, 1,1,2,2,4,3),> status=c(1,NA,1,0,0,1,1),> x= c(0, 2,1,1,1,0,0),> sex= c(0,0,0,0,1,1,1))> !

 predict(cox,new,type="expected")> > > # }> # else if (type == "expected") {> # if (missing(newdata)) > # pred <- y[, ncol(y)] - object$residuals> # else stop("Method not yet finished")> Looks like this is "by design"; see the code above.> > You might try to use cph and predict.Design from Frank Harrell's Design package> instead.> > Dieter> > ______________________________________________> 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.
_________________________________________________________________
If you like crossword puzzles, then you'll love Flexicon, a game which comb[[elided Hotmail spam]]

        [[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. Received on Sat 07 Jun 2008 - 20:59:50 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 07 Jun 2008 - 23:30:43 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive