Generalized Additive Models: An Introduction with R
In 2006 I published a book called
Generalized Additive Models: An Introduction with R , which aims to
introduce GAMs as penalized GLMs, and Generalized Additive Mixed Models
as examples of generalized linear mixed models. It also serves as a useful
reference for the mgcv package in R. The book has chapters on linear
models, generalized linear models, how a GAM is constructed using
penalized regression splines, GAM theory, using GAMs with mgcv and finally
on mixed models and generalized additive mixed models.
You can take a look at Chapter 1 here ).
The current errata
list for the first edition can be found here .
Second edition 2017
The second edition of the book was published in 2017. The second edition is a major re-write covering the advances in the decade since the first edition. It has a completely revised structure, with greater emphasis on mixed models and the equivalence of smooths and Gaussian random fields. An enhanced range of smoothers is covered, along side a thorough upgrading of the chapter on GAM theory, and many new examples including functional data analysis, survival analysis, location-scale modelling and more.
The errata list for the second edition is here.
First edition book reviews (that I know about):
Software changes affecting the first edition.
Changes with mgcv 1.5
The major change in 1.5 is that smoothness selection can now be done using
REML or ML, in additition to GCV, GACV or AIC/UBRE. This has lead to some
changes in how `gam' is called:
- `gam.method' no longer exists.
- Smoothness selection method is now controlled by the
`method' argument to `gam'.
- The optimizer used to do this is controlled by the `optimizer'
argument to `gam',
Changes with mgcv 1.4
mgcv 1.4 has several features not covered in the book, and means that the
output presented in the book will differ slightly in a few places. The
output changes are as follows:
The new features in mgcv 1.4 are:
- p-values for individual smooth terms, returned by summary.gam and
anova.gam have changed. The new versions are more reliable.
- Section 6.7.1 `a' should be removed from parametric part of gamm
model formula, as s(t,k=5,by=a) is not subject to an identifiability
constraint for mgcv >= 1.4.
- Section 5.2.4 and 5.2.5 example results will differ slightly: the
`by' variables should really have been included in the parametric part of
the model formula for mgcv < 1.4, but were not. The new results are
- "perf.magic" should be replaced by "perf" for in the chapter 5 brain
- `negative.binomial' should be replaced by `negbin' in the
chapter 5 mackerel survey example (and the method set to
- Chapter 5 Exercise 8: the mechanism for adding user defined smooths
has been simplied. See ?smooth.construct for details.
- The ability to include terms that are linear functionals of smooths
(Wahba's `general spline smoothing problem' which includes functional
linear models, GLASS models, signal regression etc.) See
- The ability to give different smooths the same smoothing parameters.
- `by' variables can now be factors. See ?gam.models.
- The parametric part of the model can be penalized. See ?gam.models.
- Smooth term-wise p-values are now much better approximations.
- gamm can now accept nested models.
- Negative binomial models are handled by a new family `negbin' and now
work with outer and performance iteration (although the former is slow).
- Eilers and Marx style P-splines are now one of the built in classes,
along with cyclic versions. See ?p.spline.
- There is an adaptive smoother available. See ?adaptive.smooth
- The interface for adding user defined smooths has changed, and is now
simpler. See ?smooth.construct.
- For further details see the mgcv