Preface
The following provides a brief introduction to generalized additive models and some thoughts on getting started with R. It doesn’t assume much more than a basic exposure to regression, and maybe a general idea of R, though not necessarily any particular expertise. The presentation is of a very applied nature, and such that the topics build upon the familiar and generalize to the less so, with the hope that one can bring the concepts they are comfortable with to the new material. The audience in mind is anyone that has some data modeling background and would like to learn more about this type of model.
As this document is more conceptual, a basic familiarity with R is all that is needed to follow the code, though there is much to be gained from having more familiarity. One should also note that the tidyverse is used throughout for any data processing that might be shown depicted. And while it wasn’t the intention starting out, this document could be seen as a vignette for the mgcv package, which is highly recommended.
The content of this document is heavily indebted to the first and second editions of Wood’s GAM book, and I’ve tried to keep things up to date with both the package and text.
Color guide:
- important term
- link
- package
- function
- object or class
Packages to note:
- data processing
- tidyverse
- models
- mgcv
- lme4 *
- mixedup *†
- gratia *
- visualization
- plotly *
- visibly *†
- ggeffects *
- gratia *
* demo and/or not required
† Personal package
Many others are used behind the scenes. In addition, I do a lot of cleanup for visualizations in general.
R Info: R version 4.2.1 (2022-06-23) Funny-Looking Kid
This document was last modified 2022-07-16. Original draft August 2012. (@$%* me I’ve been doing this stuff a while).