A Beginner's Guide to Generalized Additive Mixed Models with R (2014)
Zuur AF, Saveliev AA, Ieno EN
This book begins with an introduction to generalised additive models (GAM) using stable isotope ratios from squid.
In Chapter 2 we explain additive mixed effects using polar bear movement data. In Chapter 3 we apply additive mixed effects models on coral reef data. Ruddy turnstone data are used in Chapter 4 to explain Poisson generalised additive mixed effects models (GAMMs) using the gamm4 package. A simulation study is applied to investigate the effect unbalanced random effects. In Chapter 5 parasite data sampled on anchovy fishes are used to explain overdispersed Poisson GAMM, negative binomial GAMM, and NB-P GAMM models. We briefly discuss generalised Poisson models for underdispersed data.
In Chapters 6 and 7 two-dimensional smoothers are applied on zero-inflated guillemots and harbour porpoise datasets. A short revision of zero-inflated models is included. Gamma GAMMs are applied on two-way nested tree data in Chapter 8. In Chapter 9 binary nested data are analysed using binomial GAMM.
In Chapter 10 we analyse maximum length of cod fishes. The generalised extreme value distribution is used. The data are from a large number of spatial locations and we use INLA to implement spatial correlation. In Chapter 11 sea ducks are analysed using zero-inflated Poisson GAMMs (and GLMMs) with spatial correlation. We again use INLA. Throughout the book we contrast frequentist and Bayesian approaches. All R code is either included and explained in the book or is available from the website for the book.
The title of this book contains the phrase ‘Beginner’s Guide to …’. This does not mean that this book is for the statistical novice and can be read as a stand-alone book. On the contrary, we assume that the reader is familiar with R, data exploration, multiple linear regression, generalised linear modelling, generalised additive modelling, linear mixed effects modelling, and Markov chain Monte Carlo (MCMC) techniques. This is quite a substantial number of statistical techniques. This book is written as a sequel to our Beginner’s Guide to GAM with R and Beginner’s Guide to GLM and GLMM with R books. If you are familiar with the material described in those two books, then the current volume is indeed a ‘Beginner’s Guide’. But if you are not familiar with these techniques then the learning curve may be steep. However, wherever possible we have included short revisions. And we also provide the reader with access to Chapter 1 of Zuur et al. (2012a), which contains an introduction to Markov chain Monte Carlo techniques (see below for access details).
In this book we take the reader on an exciting voyage into the world of generalised additive mixed effects models (GAMM). Keywords are GAM, mgcv, gamm4, random effects, Poisson and negative binomial GAMM, gamma GAMM, binomial GAMM, negative binomial-P models, GAMMs with generalised extreme value distributions, overdispersion, underdispersion, two-dimensional smoothers, zero-inflated GAMMs, spatial correlation, INLA, Markov chain Monte Carlo techniques, JAGS, and two-way nested GAMMs. The book includes three chapters on the analysis of zero-inflated data.
Table of Contents: Table of Contents
Data sets and R coded used
All data sets used in the book are provided as *.txt or *.csv files. Right-mouse click on a data file and click on Save-As. R code for each chapter is password protected. The password is given on page vi in the preface of the book. See the paragraph "Data sets and R code used in this book". All R code was updated in May 2015.
Support routines that we use in various chapters:
- MCMCSupportHighstatV2.R (older version: MCMCSupportHighstat.R)
- Just copy these files in the working directory (use Save As) and type: source(file = "HighstatLibV6.R"), source(file = "MCMCSupportHighstatV2.R") and source(file = "SupportFilesHighstat.R").
- Pdf file with some simple explanations on matrix notation.
Chapter 1: Introduction
- Data used: SquidNorway.txt
- R code used: Chapter1_Squid.zip
Chapter 2: Additive mixed effects models applied on polar bear movement data
- Data used: PolarBearsV2.txt
- R code used: Chapter2_PolarBears.zip
Chapter 3: Additive mixed effects models applied on coral reef data
- Data used: coralData.txt
- R code used: Chapter3_CoralReef.zip
Chapter 4: Poisson GAMM applied on ruddy turnstone data
- Data used: TurnstoneDataV2.txt
- R code used: Chapter4_TurnStone.zip
Chapter 5: GAMM applied on parasite data
- Data used: Anchoita.csv
- R code used: Chapter5_Parasites.zip
Chapter 6: Zero-inflated sea bird data sampled at offshore wind farms
- Data used: Common_Guillemot.txt
- R code used: Chapter6_Guillemots.zip
Chapter 7: Zero-inflated GAMM applied on harbour porpoise
- Data used: Not available
- R code used: Chapter7_HarbourPorpoise.zip
Chapter 8: Gamma GAMM applied on tree growth data
- Data used: BeechDataV2.txt
- R code used: Chapter8_Beech.zip
Chapter 9: Bernoulli GAMM applied on cowbird brood parasitism
- Data used: CowbirdV2Book.txt
- R code used: Chapter9_Cowbirds.zip
Chapter 10: GAMM applied on maximum cod length using inla
- Data used: CodMaximumLenghtV3.txt.zip (the data file is zipped)
- R code used: Chapter10_Cod.zip
Chapter 11: Zero-inflated and spatial correlated Common Scoter data
- Data used: SeaDucks4.zip (zipped)
- R code used: Chapter11_SeaDucks.zip