+ All Categories
Transcript
Page 1: From GLMs to GAMs

From GLMs to GAMs

April 27, 2021

Radost Roumenova Wenman, FCAS, MAAA, CSPAConsulting Actuary

Page 2: From GLMs to GAMs

Introduction

2

Generalized Linear Models GLM Generalized Additive Models GAM

�𝑔𝑔 𝐸𝐸 𝑦𝑦 = π‘Ώπ‘Ώπ‘»π‘»πœ·πœ· + 𝑓𝑓 𝑧𝑧�𝑔𝑔 𝐸𝐸 𝑦𝑦 = π‘Ώπ‘Ώπ‘»π‘»πœ·πœ·= GLM + 𝑓𝑓 𝑧𝑧

Page 3: From GLMs to GAMs

How about Polynomial Fits?

3

Page 4: From GLMs to GAMs

Background

Trevor Hastie and Robert Tibshirani

(1986) Replace the linear predictor

with an β€œadditive” predictor

Utilizes smooth functions

Useful in uncovering

nonlinear effects

Completely automatic

β€œNo detective work is

needed…”

4

Page 5: From GLMs to GAMs

GAMs vs. GLMs

General Linear Model (GLM)

Generalized Linear Models (GLMs)

Generalized Additive Models (GAMs)

5

Transform X

log (x), x2, x3,Box-Cox…

Categorize X GAMs

How Can We Address Nonlinearity?

Page 6: From GLMs to GAMs

Modeling Nonlinearity

6

Page 7: From GLMs to GAMs

Basis Functions

7

𝑔𝑔 𝐸𝐸 |π‘Œπ‘Œ 𝑋𝑋 = 𝑏𝑏0 + 𝑏𝑏1𝑋𝑋1 + 𝑏𝑏2𝑋𝑋2 + β‹―+ 𝑏𝑏9𝑋𝑋9

𝐟𝐟 𝑿𝑿 = 𝑔𝑔 𝐸𝐸 |π‘Œπ‘Œ 𝑋𝑋 = 𝑏𝑏0 + 𝑏𝑏1B1 X + 𝑏𝑏2B2 X + β‹―+ 𝑏𝑏9B9(X)

Page 8: From GLMs to GAMs

Regression Splines

8

Page 9: From GLMs to GAMs

Smoothing Splines and the Bias-Variance Trade-off

9

Page 10: From GLMs to GAMs

GAM – Example with Poisson

10

log πœ‡πœ‡π‘–π‘– = log 𝑛𝑛𝑖𝑖 + πœ‚πœ‚π‘–π‘– = log 𝑛𝑛𝑖𝑖 + 𝛽𝛽𝑧𝑧𝑖𝑖log πœ‡πœ‡π‘–π‘– = log 𝑛𝑛𝑖𝑖 + πœ‚πœ‚π‘–π‘– = log 𝑛𝑛𝑖𝑖 + 𝑓𝑓(𝑧𝑧𝑖𝑖)

GLMGAM

𝑙𝑙 𝑧𝑧, πœ‡πœ‡ = �𝑖𝑖=1

𝑛𝑛

𝑧𝑧𝑖𝑖 log πœ‡πœ‡π‘–π‘– βˆ’ πœ‡πœ‡π‘–π‘– βˆ’ log 𝑧𝑧𝑖𝑖!

= �𝑖𝑖=1

𝑛𝑛

𝑧𝑧𝑖𝑖 f 𝑧𝑧𝑖𝑖 βˆ’ exp(f 𝑧𝑧𝑖𝑖 ) βˆ’ log 𝑧𝑧𝑖𝑖!

βˆ’12πœ†πœ†οΏ½ 𝑓𝑓′′ 𝑧𝑧 2 d𝑧𝑧= οΏ½

𝑖𝑖=1

𝑛𝑛

𝑧𝑧𝑖𝑖 f 𝑧𝑧𝑖𝑖 βˆ’ exp(f 𝑧𝑧𝑖𝑖 ) βˆ’ log 𝑧𝑧𝑖𝑖!

Page 11: From GLMs to GAMs

Flexibility of GAMs

β€’ Multiple predictors

β€’ Mixture of smoothing splines, linear terms, and nominal variables

β€’ Smooth interactions

11

Page 12: From GLMs to GAMs

GAM Summary Output

12

Family: gaussian Link function: identity

parametric coefficients:Estimate Std. Error t value Pr(>|t|) (Intercept) -25.546 1.951 -13.1 <2e-16 ***

coef(gam_mod) – smooth terms:s(z).1 s(z).2 s(z).3 s(z).4 s(z).5-63.718 43.476 -110.350 -22.181 35.034

s(z).6 s(z).7 s(z).8 s(z).993.176 9.283 -111.661 17.603

Approximate significance of smooth terms:edf F p-value

s(z) 8.693 53.52 <2e-16 ***

R-sq.(adj) = 0.783 Deviance explained = 79.8%GCV = 545.78 Scale est. = 506 n = 133

Hypothesis Testing, GCV, AIC, Stepwise Variable Selection, Shrinkage

Page 13: From GLMs to GAMs

Insurance Application of GAMs – Geospatial Smoothing

Including geographic territories directly in a GLM is generally not feasible!

β€’ Popular technique – smoothing and clustering

– zero exposure?

– homogeneous?

– clustering method?

β€’ Alternative technique – GAM

– directly applies spatial smoothing

– can use longitude and latitude

13

Page 14: From GLMs to GAMs

GAM Approach to Modeling Geolocation Dataβ€’ Method 1 (two-step)

– include non-geographic variables as predictors in a GLM

– extract the GLM residuals

– use GAM to regress the GLM residuals on f(longitude, latitude)

β€’ Method 2 (two-step)

– include non-geographic variables as predictors in a GLM

– extract the GLM linear predictor

– Use the GLM linear predictor as an offset in a GAM only with f(longitude, latitude)

β€’ Method 3 (one-step)

– include all variables, including geolocation, as predictors in a GAM

14

Page 15: From GLMs to GAMs

In a Nutshell…

GAMs = Penalized GLMs!

15

Page 16: From GLMs to GAMs

Recommended References

β€’ Hastie, T., Tibshirani, R. (1990). Generalized Additive Models, Chapman & Hall/CRC.

β€’ Wood, S. (2017). Generalized Additive Models: An Introduction with R, Chapman & Hall/CRC.

β€’ Fahrmeir, L., Kneib, T., Lang, L., Marx, B. (2013). Regression: Models, Methods and Applications, Springer.

β€’ Klein, N., Denuit, M., Lang, S., and Kneib, T. (2014). Nonlife Ratemaking and Risk Management with Bayesian Generalized Additive Models for Location, Scale, and Shape. Insurance: Mathematics and Economics 55:225–49.

β€’ http://www.variancejournal.org/issues/13-01/141.pdf

β€’ https://www.soa.org/globalassets/assets/files/e-business/pd/events/2020/predictive-analytics-4-0/pd-2020-09-pas-session-006.pdf

16

Page 17: From GLMs to GAMs

Radost R. Wenman, FCAS, MAAA, CSPA415.692.0260

Thank You

[email protected]


Top Related