Introduction to Generalized Additive Models

Nonlinear Modeling with Generalized Additive Models (GAMs) in R

Noam Ross

Senior Research Scientist, EcoHealth Alliance

Trade-offs in model building

$$

$$

Nonlinear Modeling with Generalized Additive Models (GAMs) in R

Non-linear relationships

Nonlinear Modeling with Generalized Additive Models (GAMs) in R

Nonlinear relationships

linear_mod <- lm(y ~ x, data = my_data)

Nonlinear Modeling with Generalized Additive Models (GAMs) in R

Nonlinear relationships

library(mgcv)
gam_mod <- gam(y ~ s(x), data = my_data)

Nonlinear Modeling with Generalized Additive Models (GAMs) in R

Basis functions

$$

Nonlinear Modeling with Generalized Additive Models (GAMs) in R

Basis functions

gam_mod <- gam(y ~ s(x), data = my_data)

coef(gam_mod)
(Intercept)     s(x2).1     s(x2).2    
7.814448        5.272290    5.104941

s(x2).3         s(x2).4     s(x2).5
1.271135        1.720561   -1.180613 

s(x2).6 
-2.676133
Nonlinear Modeling with Generalized Additive Models (GAMs) in R

Let's practice!

Nonlinear Modeling with Generalized Additive Models (GAMs) in R

Preparing Video For Download...