[R] fit data with gammadistribution

Francisco J. Zagmutt gerifalte28 at hotmail.com
Mon Sep 12 19:09:05 CEST 2005

Somebody already did the job for you.  Try fitdistr{MASS} i.e.

x=scan("clipboard")#Read your data from clipboard
fitdistr(x,"gamma", list(shape=sh, scale=sc))

Now you probably know that you have to be carfeul when estimating 
distribution parameters from such a small number of observations.

PS: this is a very "popular" question so in the future before you post a 
question try RSiteSearch() i.e.  RSiteSearch("fit gamma") gave me 273 hits



>From: Nadja Riedwyl <riedwyl at giub.unibe.ch>
>To: r-help at stat.math.ethz.ch
>Subject: [R] fit data with gammadistribution
>Date: Mon, 12 Sep 2005 12:58:00 +0200
>my data is
>data2:2743  4678 21427  6194 10286  1505 12811  2161  6853  2625 14542   
>11491 14924 28640 17097  2136  5308  3477 91301 11488  3860 64114 14334
>by calculating
>i get the idea what the parameters of the gammadistribution would be.
>but if i try using the method mle() i get stock and i don't know, how to 
>it work. can anybody help me? thank you very much, indeed.
>I tried so fare
>NaN's are produced with optim, i just don't know how to avoid this!
>R-help at stat.math.ethz.ch mailing list
>PLEASE do read the posting guide! 

More information about the R-help mailing list