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

Peter Ehlers ehlers at ucalgary.ca
Fri Nov 20 20:49:56 CET 2009


Quite right, David. I forgot to indicate that MASS needs of course
to be loaded. It's such a useful package that I usually have it
loaded.

Raymond:
When you ask for help with a function in an add-on package
you should indicate that package in your query.

  -Peter Ehlers

David Winsemius wrote:
> 
> 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")]
>




More information about the R-help mailing list