Nonlinear Modeling with Generalized Additive Models (GAMs) in R
Learn to fit, plot and check generalized additive models in R with mgcv, then use them for spatial surfaces and binary classification.
Generalized additive models (GAMs) fit a smooth curve to each predictor, letting a model follow bends in the data that a straight-line regression would miss while every effect remains open to inspection, unlike methods whose inner workings stay hidden. You build these models in R with the mgcv package, keep each curve flexible enough without overfitting, and use them to predict and explain results on motorcycle crash readings, car performance figures, soil pollution measurements and customer purchase records.
What You Will Achieve
- Fit a GAM in R that follows a curved relationship in the data without chasing noise.
- Diagnose an underfit model and hidden relationships between variables, then refit it until the results improve.
- Map soil pollution as a smooth surface over space and present it in a 3D plot.
- Predict whether a customer will buy with a logistic model and explain the variables behind each prediction.
Program Overview
Building Generalized Additive Models in mgcv
Fitting smooth nonlinear functions with gam() and combining them with linear and categorical terms in a single model.
- Basis functions and smoothing
- Model complexity and overfitting
- Multivariate models with categorical effects
- Category-level smooths
Interpreting, Visualizing and Checking GAMs
Reading model output, plotting effects with their uncertainty, and finding and fixing problems in how a model fits.
- Significance and linearity of terms
- Effect plots and uncertainty
- Model checks with gam.check()
- Concurvity between variables
Spatial Interactions and Logistic Classification
Extending GAMs to surfaces over space, interactions across very different scales, and binary outcomes such as whether a customer makes a purchase.
- Two-dimensional smooths and 3D surface plots
- Categorical-continuous and tensor interactions
- Logistic GAMs and purchase probability
- Predictions and explaining individual behaviors
Certificate Awarded (Paid)
Job Outlook
These skills apply in data science and analytics work where a model has to capture curved relationships yet stay explainable, including spatial, performance and customer data.
Good for: R analysts who want models that follow curved relationships in their data and still show, plot by plot, how each variable shapes the result.
Keep in mind: Every exercise uses R and the mgcv package, and the first three chapters model continuous outcomes; classification arrives only in the final chapter, with binary outcomes.
Bottom line: A hands-on route into GAMs that gives a full chapter to reading, plotting and checking models before moving on to spatial and classification work.
Frequently Asked Questions
What data are the GAMs fitted to?
Motorcycle crash data contrasts linear and nonlinear fits, automobile performance data supports models that mix linear, nonlinear and categorical effects, soil pollution data from the Netherlands drives the spatial models, and consumer purchase data is used for classification.
How does the course deal with a badly fitting model?
The second chapter runs gam.check() and teaches you to read its diagnostics, then shows how to spot underfitting and hidden relationships between variables through concurvity checks on the auto data, refitting the model step by step.
What are tensor smooths used for here?
Tensors model interactions between variables measured on very different scales, such as space and time. The course applies them to soil pollution models and then shows how to tease apart the separate parts of those multi-scale interactions.
Please log in to report a problem with this page.


There are no reviews yet.