
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 <dwinsemius@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]]


