[R] How to use results of distribution fitting for further processing?

David Winsemius dwinsemius at comcast.net
Fri Nov 20 20:02:03 CET 2009


On Nov 20, 2009, at 1:47 PM, Peter Ehlers wrote:

>
>
> Raymond Wong wrote:
>> This is probably simple, but I have a hard time finding the  
>> solution. Any help greatly appreciated.
>> I would like to use the results of  
>> fitdistr(z,densfun=dweibull,start=list(scale=1,shape=1)) for  
>> further processing.  How do I assign the values of scale and shape  
>> to b and a without manually entering the numbers?
>

library(MASS)

> fd <- fitdistr(z,densfun=dweibull,start=list(scale=1,shape=1))
> str(fd)
> fd$estimate
> fd$estimate[1]
>
> etc
>
> Remember the ever useful str().

Agree! You cannot learn R without knowing to use str().

Could also get more self-documenting code with:

fd$estimate[c("scale", "shape")]

-- 
David

>
> -Peter Ehlers


David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list