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

______________________________________________
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