ABSTRACT

Chapter 2 proposes that ecological dynamics typically depend upon state-variables that cannot be directly observed, and these unobserved variables complicate defining a likelihood function that can be used to estimate parameters. It then introduces the concept of random effects, where these are marginalized across (using an integral or summation) to calculate a marginal likelihood that is useful for estimation. To facilitate computing this integral, Chapter 2 introduces the Laplace approximation and shows how this can be implemented in basic R functions or automatically using Template Model Builder (TMB). In particular, the chapter presents a simplified example involving a known probability distribution, and then illustrates the Laplace approximation for fitting a Generalized Linear Mixed Model (GLMM). Finally, Chapter 2 introduces basic considerations when using TMB to implement the Laplace approximation, including the concept of separable random effects, and common errors in coding these models.