Generalized Additive Model
Study guides: Exam MAS-I, Exam ACIA-CAPSTONE
A Generalized Additive Model (GAM) is a regression model that replaces each linear term \beta_j x_{ij} of a multiple linear regression with a smooth non-linear function f_j(x_{ij}) of that predictor, and adds the functions together. The GAM for a quantitative response is
y_i = \beta_0 + \sum_{j=1}^{p} f_j(x_{ij}) + \varepsilon_i
y_iis the response of observationi, andx_{ij}is its value of the predictorx_j, forj = 1, \ldots, p.\varepsilon_iis the error term.
Each f_j can be fitted with any method for one predictor: a regression spline or natural spline, a smoothing spline, local regression, polynomial regression or a step function. A function f_j can also stay linear, and a qualitative predictor enters with a separate constant for each level. When every f_j is a natural spline or a step function, the GAM is one least squares regression on the spline basis functions and the indicator variables. The smoothness of each fitted f_j is summarized by its effective degrees of freedom.
A severity GAM has a natural spline in building age with 4 degrees of freedom, a natural spline in square footage with 5, and a step function over 4 construction classes. How many coefficients does the least squares fit estimate?
- The intercept is 1 coefficient.
- The two natural splines contribute 4 and 5 basis functions.
- The 4 construction classes need 3 indicator variables alongside the intercept.
- The fit estimates
1 + 4 + 5 + 3 = 13coefficients.
Additivity
Because the model is additive, the effect of each predictor on the response can be examined while the other predictors are held fixed. A change in x_j changes the prediction by the same amount whatever the values of the other predictors, which makes a GAM useful for inference. Additivity also means that a GAM misses interactions between predictors. An interaction can be added by hand, as a product term x_j \times x_k or as a function f_{jk}(x_j, x_k) of two predictors fitted with a two-dimensional smoother.
Logistic regression GAM
For a binary response, the GAM replaces the linear predictor of logistic regression with the same additive form:
\ln\left(\frac{\pi}{1 - \pi}\right) = \beta_0 + f_1(x_1) + f_2(x_2) + \cdots + f_p(x_p)
\pi = P(Y = 1 \mid x_1, \ldots, x_p)is the probability that the response is 1.
A logistic GAM for the probability of a claim has intercept
-2.2and fitted functionsf_1(22) = 0.65andf_1(45) = -0.20for driver age,f_2(3) = -0.10for vehicle age andf_3(\text) = 0.30for territory. What is the probability of a claim for a 22-year-old with a 3-year-old vehicle in the Urban territory, and what is the odds ratio between drivers aged 22 and 45?
- The log-odds for the 22-year-old are
-2.2 + 0.65 - 0.10 + 0.30 = -1.35.- The probability of a claim is
\pi = e^{-1.35}/(1 + e^{-1.35}) = 0.206.- With vehicle age and territory held fixed, their terms cancel in the difference of the log-odds, which is
0.65 - (-0.20) = 0.85.- The odds ratio is
e^{0.85} = 2.34, for every vehicle age and territory.
Expecting a GAM to find interactions A GAM fits each predictor's effect separately and adds them. If young drivers are much riskier only in urban territories, a GAM without an interaction term gives young drivers the same odds ratio in every territory.