Skip to content
Prev 274631 / 398506 Next

simultaneously maximizing two independent log likelihood functions using mle2

Adam Zeilinger <zeil0006 <at> umn.edu> writes:
The most convenient way to do this would be to use the
'parameters' argument to mle2.  For example,

FFR.holling2.byyear <- mle2(NLL.holling2, start = list(a = 0.012,
    h = 0.84), data = c(list(T = 14, P = 3), ReedfrogFuncresp),  
    parameters=list(a~year, h~year))

-- or you could fit a model where only one or the other of the
parameters varied between years.
   R should automatically construct a set of parameters (in 
this case 'a for year 1', 'delta-a between year 1 and year 2',
'h for year 1', 'delta-h between year 1 and year 2'); it
sets the starting values of the 'delta' variables to zero
by default.  (Things get a little bit tricky if you also 
want to set lower and upper bounds.)  [See section 6.6.1 of
the book for more details.]

   Note that I have included ReedfrogFuncresp in the data list.
I now regret using attach() in the book examples.

  Ben Bolker