[R] error estimating parameters with mle2

Ben Bolker bbolker at gmail.com
Wed Apr 18 14:46:03 CEST 2012

Joachim Audenaert <Joachim.Audenaert <at> pcsierteelt.be> writes:

> When I try to estimate the functional response of the Rogers type I 
> equation (for the mle2 you need the package bbmle):
> > RogersIbinom <- function(N0,attackR2_B,u_B) {attackR2_B+u_B*N0}
> > RogersI_B <- 
> mle2(FR~dbinom(size=N0,prob=RogersIbinom(N0,attackR2_B,u_B)/N0),
>  I get following error message
> Error in optim(par = c(4.5, 0.16), fn = function (p)  : 
>   function cannot be evaluated at initial parameters
> Can someone tell me what I'm doing wrong? I used estimate starting values 
> which were predicted with the nls function 
> RogersI_N <- 
> nls(FR~attackR2_N+u_N*N0,start=list(attackR2_N=1,u_N=4),
>  control=list(maxiter=10000))

  It's hard to know without a reproducible example.
  I'm a little confused by the broader context here because it looks
like your "Rogers functional response" is just linear?? (In the context
of functional response models in ecology I think of the Rogers random
predator equation -- maybe I have the wrong idea.)

  If your predicted per capita attack probability is greater than
1 for any case, then you're going to be in trouble here ...

  Ben Bolker

More information about the R-help mailing list