On Jul 17, 2009, at 12:52 AM, Sean Brummel wrote:

> This conversation is digressing... Here is my question, what does  
> the value from the predict function mean? AS STATED IN MY CODE.  Try  
> running the example that I gave.
>
> predict(model,type=c("response"))[1]=?????????

Look at the help page and work through the examples:

  Expected survival  time, in the units being measured for time, of an  
individual with the same covariates as the first subject. It is not a  
probability. If you want a probability rather than a time, you need to  
use type ="quantile" and then supply an appropriate set of percentiles.


>
> Sean
>
> On Thu, Jul 16, 2009 at 8:27 PM, David Winsemius <dwinsem...@comcast.net 
> > wrote:
>  Wouldn't the "response" of a survival model be survival times? You  
> may want to look at survfit and survest.
>
> -- 
> DW
>
>
> On Jul 16, 2009, at 9:19 PM, Sean Brummel wrote:
>
>> 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.

Reply via email to