Re: [R] Error optimizing Poisson log-likelihood with L-BFGS-B

2007-10-31 Thread Ben Bolker
Sergey Goriatchev wrote: > > > [snip] > > I cannot run this because I always get an error message: > > Error in optim(par = 1, poisson.loglik, lower = 0, method = "L-BFGS-B", : > non-finite finite-difference value [1] > > Could someone enlighten me what that means and why this happens? >

[R] Error optimizing Poisson log-likelihood with L-BFGS-B

2007-10-31 Thread Sergey Goriatchev
Dear R users, I have following code, estimating Poisson log-likelihood a number of times: poisson.loglik <- function(mu, y){ n <- NROW(y) logl <- sum(y)*log(mu)-n*mu return(-logl) } estimates <- numeric(1e5) for(i in seq_along(estimates)){ estimates[i] <- optim(par=1, poisson.lo