2 Loading libraries

In order to analyze these data with GAMs, we will use the following libraries:

library(dplyr)
library(tidyr)
library(ggplot2)
library(mgcv)
library(itsadug)
library("gratia")
  • dplyr and tidyr are great for data wrangling, transforming data, etc.
  • ggplot2 is the de facto library to create figures
  • mgcv (Wood 2017) implements mixed GAM computations
  • itsadug (van Rij et al. 2017) helps in the interpretation of time-series, and autocorrelated data
  • gratia (Simpson 2021) provides alternative figures based on ggplot2 and other functions for GAMs.

References

Simpson, Gavin L. 2021. gratia: Graceful “ggplot”-Based Graphics and Other Functions for GAMs Fitted Using “mgcv”. https://CRAN.R-project.org/package=gratia.
van Rij, Jacolien, Martijn Wieling, R. Harald Baayen, and Hedderik van Rijn. 2017. itsadug: Interpreting Time Series and Autocorrelated Data Using GAMMs.
Wood, Simon N. 2017. Generalized Additive Models: An Introduction with r. 2nd ed. CRC press.