[R] Gamma MLE

rach.s seow_ainee at hotmail.com
Sat Jul 21 20:36:07 CEST 2007


Hello,

I was asked to try the following code on R,

gamma.mles
function (xx,shape0,rate0)
{
n<- length(xx)
xbar<- mean(xx)
logxbar<- mean(log(xx))
theta<-c(shape0,rate0)
repeat {
theta0<- theta
shape<- theta0[1]
rate<- theta0[2]
S<- n*matrix(c(log(rate)-digamma(shape)+logxbar,shape/rate-xbar),ncol=1)
I<- n*matrix(c(trigamma(shape),-1/rate,-1/rate,shape/rate^2),ncol=2)
theta<- theta0 + solve(I) %*% S
if(max(abs(theta-theta0)) < 1e-08)
break
}
list(estimates=theta, infmat=I)
}

However, this appears: Error: object "gamma.mles" not found

I tried looking in the packages for gamma.mles, but I couldn't find it
anywhere. Can someone tell me where can I load it?

Thanks
-- 
View this message in context: http://www.nabble.com/Gamma-MLE-tf4122769.html#a11724823
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list