[R] ML fit of gamma distribution to grouped data
Thomas Petzoldt
petzoldt at rcs.urz.tu-dresden.de
Thu Nov 30 18:51:40 CET 2006
Dear Augusto,
thank you for your example. Your solutions are the in fact the usual
methods, but these do not apply to my case because I have grouped data.
The good news is, that the solution of Prof. Brian Ripley works
perfectly -- of course :-)
Thank you both for your help.
Thomas P.
Augusto.Sanabria at ga.gov.au wrote:
> Thomas,
>
> The Gamma distr. can be fitted via ML using:
>
> Library("MASS")
> GF <- fitdistr(given_data,"gamma")
> sh <- GF$estimate[1]
> ra <- GF$estimate[2]
>
> Fitting via Moments, m:
> var <- m[2] - m[1]*m[1]
> sh <- m[1]*m[1]/var
> sc <- m[1]/var
> ra <- 1/sc
>
> G_pdf <- dgamma(breaks,shape=sh,rate=ra,scale=1/ra)
>
>
> Hope it helps,
>
> Augusto
[...] original message deleted
More information about the R-help
mailing list