usgs icon pwrc icon

Applied hierarchical modeling in Ecology

by Marc Kéry & Andy Royle

This is the permanent book web site of the Applied hierarchical modeling (AHM) project. It comprises two volumes of a book with the same name and the R package AHMbook which can be downloaded from CRAN; our BIG thanks for this go to Mike Meredith!

We plan to publish the solutions to some or all the exercises in AHM volume 1, but this will likely have to wait until AHM volume 2 is written (which we hope is sometime in the 2nd half of 2017).

For a more dynamical (i.e., more frequently updated) AHM page, see our Google page here:

Get your copy of the book from Amazon:

Overview of chapters in volumes 1 and 2 of AHM:

AHM Volume 1: Prelude and static models


    Part 1: Prelude

  1. Distribution, abundance and species richness in ecology
  2. What are hierarchical models and how do we analyze them?
  3. Linear models, generalized linear models (GLMs), and random-effects: the components of hierarchical models
  4. Introduction to data simulation
  5. The Bayesian modeling software BUGS and JAGS
  6. Part 2: Models for static systems

  7. Modeling abundance using binomial N-mixture models
  8. Modeling abundance using multinomial N-mixture models
  9. Modeling abundance using hierarchical distance sampling
  10. Advanced hierarchical distance sampling
  11. Modeling distribution and occurrence using site-occupancy models
  12. Community models

AHM Volume 2: Dynamic and Advanced models

    Part 3: Models for dynamic systems

  1. Poisson Generalized Linear Mixed Models (GLMMs) and related models
  2. Modeling population dynamics with replicate counts within a season
  3. Modeling population dynamics with distance sampling data
  4. Hierarchical models of survival
  5. Modeling species distribution and range dynamics using dynamic occupancy models
  6. Modeling metacommunity dynamics using dynamic community models
  7. Part 4: Advanced models

  8. Multi-state occupancy models
  9. Modeling false-positives
  10. Models for species interactions
  11. Spatial models I
  12. Spatial models II
  13. Combination approaches / Integrated models
  14. Spatial distance sampling and spatial capture-recapture
  15. Conclusions

The new AHMbook R package

To install the AHMbook R package, you need R version 3.3.0 or later. Thanks to the efforts of Mike Meredith, AHMbook is now a genuine R package, so you can download it from CRAN in the usual way, e.g., by typing in your R console


Four AHM extra data files
We used to supply four additional data files that are used in AHM1: the Swiss tits (SwissTits_mhb_2004_2013.csv), Dutch wagtails (wagtail.Rdata), Swiss squirrels (SwissSquirrels.txt) and the Swiss MHB 2014 data (MHB_2014.csv). All four are now part of the AHMbook package (SwissTits, wagtail, SwissSquirrels, MHB2014). Mike has undertaken some data cleaning and reformatting and the help files for each data set show ways how to use these instead of .csv files with the code in the book.

However, in case you want to replicate the analyses with the exact book code, here are the four files in the original format for download:

  1. Swiss tit data from the MHB 2004-2013 (chapter 6): SwissTits_mhb_2004_2013.csv
  2. Dutch wagtail data (chapter 9): wagtail.Rdata
  3. Swiss squirrel data from the MHB (chapter 10): SwissSquirrels.txt
  4. Swiss MHB data from 2014 (chapter 11): MHB_2014.csv
Download text file with all R and BUGS code:
(Note that we are working at a revised version that uses the new versions of the AHMbook and unmarked R packages.)

Download R_BUGS_code_AHM_Vol_1.txt

List of detected errors: link

Marc and Andy, last changes: 25 April 2017