With type="response" in the predict funtion, I was expecting an expected survival time given covariates( in my dataset I have a few covariates but not in the example)... a natural predictor. The prediction function is clearly not returning a probability of survival at a given time since my example it is greater than one.
Sean On 7/16/09, David Winsemius <dwinsem...@comcast.net> wrote: > > > On Jul 16, 2009, at 8:19 PM, Sean Brummel wrote: > > Thanks for the help but... > > I did the required transformations at the end of the code. The thing that > I dont understand is: Why is the predicted value (from the predict function) > not either the mean or median. Sorry I was not clear in my explanation. > > > > > ?predict.survreg > > > You might get better answers if you specified even more concretely what you > expected and more expansively why you think so. It sounds as though you > expect predict to give you a median or mean, but this is not what R predict > functions generally return. The predict function returns the estimated > survival at the requested times If the newdata parameter is not supplied, > then those times are taken to be those in the original dataset. > > > > > Thanks, > > Sean > > > On 7/16/09, David Winsemius <dwinsem...@comcast.net> wrote: >> >> >> On Jul 16, 2009, at 7:41 PM, Sean Brummel wrote: >> >> I am trying to generate predictions from a weibull survival curve but it >>> seems that the predictions assume that the shape(scale for >>> survfit) parameter is one(Exponential but with a strange rate estimate?). >>> Here is an examle of the problem, the smaller the shape is the worse the >>> discrepancy. >>> >>> ### Set Parameters >>> scale<-10 >>> shape<-.85 >>> ### Find Mean >>> scale*gamma(1 + 1/shape) >>> >>> ### Simulate Data and Fit Model >>> y<-rweibull(10000,scale=scale,shape=shape) >>> model<-survreg(Surv(y)~1,dist="weibull") >>> >>> ### Exp of coef and predict are the same >>> exp(model$coef) >>> predict(model,type=c("response"))[1] >>> >>> ### Here is the mean and median of the data >>> mean(y) >>> median(y) >>> >>> ### Fitted Mean and Median from survreg >>> fitScale<-exp(model$coef) >>> fitShape<-1/model$scale >>> fitScale*gamma(1 + 1/fitShape) >>> fitScale*(log(2))^(1/fitShape) >>> >>> Is this done on purpose? If so does anyone know why? >>> >> >> http://finzi.psych.upenn.edu/Rhelp08/2008-October/178487.html >> >> -- >> >> David Winsemius, MD >> Heritage Laboratories >> West Hartford, CT >> >> > > David Winsemius, MD > Heritage Laboratories > West Hartford, CT > > [[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.