[R] fit data with gammadistribution

Nadja Riedwyl riedwyl at giub.unibe.ch
Mon Sep 12 12:58:00 CEST 2005


hello
my data is
data2:2743  4678 21427  6194 10286  1505 12811  2161  6853  2625 14542   694
11491 14924 28640 17097  2136  5308  3477 91301 11488  3860 64114 14334

by calculating
shape<-(mean(data2))^2/var(data2)
scale<-var(data2)/mean(data2)

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 make 
it work. can anybody help me? thank you very much, indeed.
Nadja
I tried so fare

ll<-function(lambda,alfa) 
{n<-24
x<-data2 
-n*alfa*log(lambda)+n*log(gamma(alfa))-(alfa-1)*sum(log(x))+lambda*sum(x)
est<-mle(minuslogl=ll,start=list(lambda=29827.51,alfa=0.4954725))
summary(est)

NaN's are produced with optim, i just don't know how to avoid this!




More information about the R-help mailing list