+ All Categories
Home > Documents > From GLMs to GAMs

From GLMs to GAMs

Date post: 16-Oct-2021
Category:
Upload: others
View: 8 times
Download: 0 times
Share this document with a friend
17
From GLMs to GAMs April 27, 2021 Radost Roumenova Wenman, FCAS, MAAA, CSPA Consulting Actuary
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]


Recommended