Beginner's Guide to GLM and GLMM with R (2013)

Zuur AF, Hilbe JM and Ieno EN


This book presents generalized linear models (GLM) and generalized linear mixed models (GLMM) based on both frequency-based and Bayesian concepts.

Using ecological data from real-world studies, the text introduces the reader to the basics of GLM and mixed effects models, with demonstrations of Gaussian, binomial, gamma, Poisson, negative binomial regression, beta and beta-binomial GLMs and GLMMs.

R code is provided in the book and on this website.


Support chapters

To avoid duplication of material that we published in other books, we provide two pdf files:

Both chapters are password protected. The passwords can be found in the Preface of the book that you bought.


Table of contents

Click for Table of contents


Data sets and R code used in the book

  • All data sets used in the book are provided in a zip file:
  • All R code used in the book is provided in a zip file: This zip file is password protected. The password is given on page vi in the preface of the book. In the R scripts, you need to replace HighstatLibV6.R by HighstatLibV10.R. The same holds for the MCMC support file.
  • Pdf file with some simple explanations on matrix notation



Introduction to GLM (Poisson GLM and negative binomial GLM for count data, Bernoulli GLM for binary data, binomial GLM for proportional data, other distributions). GLM applied to red squirrel data (Bayesian approach – running the Poisson GLM, running JAGS via R, applying a negative binomial GLM in JAGS), GLM applied to presence-absence Polychaeta data (model selection using AIC, DIC and BIC in jags), introduction to mixed effects models, GLMM applied on honeybee pollination data (Poisson GLMM using glmer and JAGS, negative binomial GLMM using glmmADMD and JAGS, GLMM with auto-regressive correlation), GLMM for strictly positive data: biomass of rainforest trees (gamma GLM using a frequentist approach, fitting a gamma GLM using JAGS, truncated Gaussian linear regression, Tobit model in JAGS, Tobit model with random effects in JAGS), binomial, beta-binomial, and beta GLMM applied to cheetah data.