cc Licensed under the Creative Commons attribution-noncommercial license. Please share & remix noncommercially, mentioning its origin.

Basics

outline

  • explore data (plot)
  • define objective function (neg log likelihood)
  • decide on starting values
  • choose optimization function (optim() etc.)

Set up objective function

either

  • objective function as explicit function of parameter vector p
    • explicit
    • arbitrarily complex
  • or use bbmle::mle2 formula interface
    • simpler, readable
    • allows use of predict(), simulate(), residuals()
    • don’t have standalone prediction/log-likelihood function (except @minuslogl)

tadpoles (functional response)

From Vonesh and Bolker (2005).

Suggested models:

frogs <- emdbook::ReedfrogFuncresp
## predicted number killed with two different 
rogers_pred <- function(N0, a, h, P, time) {
  N0 - emdbook::lambertW(a * h * N0 * exp(-a * (P * time - h * N0)))/(a * h)
}
holling_pred <- function(N0, a, h, P, time) {
  a*N0*P*time/(1+a*h*N0)
}
time <- 14 ## time period
P <- 3  ## number of predators

caterpillar virus

From Reilly and Hajek (2008), a tiny data set:

dd <- read.table(header=TRUE,
           text="
density larvae surviving
1   90  60
5   90  60
10  89  56
15  87  41
20  93  31
")

Suggested model: \(S \sim \textrm{Binom}(p=\beta_0 + \beta_1 D^\beta_2\), N)$

references

Reilly, James R., and Ann E. Hajek. 2008. “Density-Dependent Resistance of the Gypsy Moth Lymantria Dispar to Its Nucleopolyhedrovirus, and the Consequences for Population Dynamics.” Oecologia 154 (4): 691–701. doi:10.1007/s00442-007-0871-3.

Vonesh, James R., and Benjamin M. Bolker. 2005. “Compensatory Larval Responses Shift Tradeoffs Associated with Predator-Induced Hatching Plasticity.” Ecology 86 (6): 1580–91.