Hello everybody!

I'm having some trouble to compute maximum likelihood estimations using maxLik 
package and I hope that you could give me a hint.
The main problem is that I'm not able to get a result not even close to the 
ones given by glm() directly, and the second one is: "Error in maxNRCompute(fn 
= logLikAttr, fnOrig = fn, gradOrig = grad, hessOrig = hess, : NA in gradient".

The codes:
loglike.GGompiMaxLik <- function(theta,age,deaths,exposures) {
 alpha <- exp(theta[1])
 beta <- exp(theta[2])
 gamma <- exp(theta[3])
 first <- alpha*exp(beta*age)
 second <- 1+(((alpha*gamma)/beta)*(exp(beta*age)-1))
 mu <- first/second
 llk <- -sum((deaths * log(mu)) + (- mu*exposures))
 return(llk)
}


fit1 <- maxLik(loglike.GGompiMaxLik,
              age=0:6,
              deaths=c(15545, 21278, 32444, 36201, 30360, 14201, 5198),
              exposures=c(935023.67, 819392.00, 724568.17, 470947.00,
231951.64, 69502.65, 15798.72),
              start=c(-4.1402817, -0.6375773, -1.6945914))

Do you know how I can solve this problem?

Thanks in advance,
Filipe
        [[alternative HTML version deleted]]

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to