I could use some advice interpreting GAM (Generalized Additive Model) coefficients.

I get the following results when I call coef on my model:

(Intercept)     s(TM).1     s(TM).2     s(TM).3
   817.9501    383.7981   2358.5184   -545.4162

Does that mean:

y = 817.9501 + 383.7981*TM + 2358.5184*TM^2 - 545.4162*TM^3
  • $\begingroup$ What was the model formula you used in R for your model? $\endgroup$ Mar 14, 2019 at 2:21
  • $\begingroup$ gam1 <- gam(Rev ~ s(TM), family = gaussian, data = data1) $\endgroup$
    – D. Kent
    Mar 14, 2019 at 11:02

2 Answers 2


Not at all. For one thing, GAM's need a link function, and also smoothers, the $g$ and the $f$'s, respectively, in the general definition:

$$\mathbb{E}(y)=g^{-1}\left(\alpha+f_1(x_1)+f_2(x_2) + \dots + f_n(x_n) \right)$$

For this reason you cannot follow the exact same usual marginal contribution interpretation done with simple linear regression; the link function and the smoothing terms get in the way.

One usual approach for GAM's is plotting the partial effects and inspect the relationships between $y$ and $x$'s visually. This article has a really nice intro to GAM's with a short discussion on interpretation in the end.


From your R syntax, it seems like you are fitting a regression model which postulates that the predictor variable TM has a potentially nonlinear effect on the response (or outcome) variable Rev. (If you had reasons to believe the effect is linear, you would use the lm() function instead of the gam() function.)

I am presuming the reason you are trying to fit a gam model is because you plotted Rev against TM and noticed some kind of nonlinearity in that plot. (Rev should be a continuous variable.)

When the gam() function is invoked for your data, it will essentially try to fit the following model to the data:

Rev = intercept + f(TM) + error

where f() is an unknown potentially linear function whose shape must be identified from the data and error is a random error term assumed to come from a normal distribution with mean 0 and unknown standard deviation sigma.

To estimate the function f(), gam will approximate f() by a linear combination of known basis functions and estimate the unknown weights these functions will receive in that combination.

What you see in your output is that gam identified that three such basis functions were sufficient to recover the underlying shape of f(): s(TM).1, s(TM).2 and s(TM).3. (All of these are known functions which depend on TM.)

R estimated the weights one should give to each of these functions in the linear combination that will approximate f(). So the function f() can be estimated as follows:

Estimated value of f(TM) ~ 383.7981*s(TM).1 + 2358.5184*s(TM).2 - 545.4162*s(TM).3

This means that the expected/average value of Rev can be estimated as:

Expected Rev = 817.9501 + 383.7981*s(TM).1 + 2358.5184*s(TM).2 - 545.4162*s(TM).3

In this context, you wouldn't want to interpret the effects of s(TM).1, s(TM).2 and s(TM).3 on the expected value of Rev. Rather, you would simply want to see how these three basis functions combine together via the estimated weights to produce a possibly nonlinear function which represents the nonlinear effect of TM on Rev. That is why it is important to simply plot 383.7981*s(TM).1 + 2358.5184*s(TM).2 - 545.4162*s(TM).3 against TM and interpret qualitatively the shape of that plot. For example, does the plot show that the expected value of Rev increases up to a point and then levels off?

This link will give you more detailed explanations on gam models and what they do under their hood: http://environmentalcomputing.net/intro-to-gams/. It will also give you clues on how to plot the possibly nonlinear effect f() you are trying to estimate.

  • $\begingroup$ In my application, I am hoping to use the GAM to make predictions. $\endgroup$
    – D. Kent
    Mar 17, 2019 at 23:17
  • $\begingroup$ In my application, I am hoping to use the GAM to make predictions. The folks who will consume these predictions will not have access to R. Instead, they will be using CPQ - or configure, price, quote - software. I need to get the model results somehow out of R and into this software. It would be easy to do this with an LM model where I can see the complete functions. Is there some way to see the actual basis functions. For example, what exactly is s(TM).1? $\endgroup$
    – D. Kent
    Mar 17, 2019 at 23:24
  • $\begingroup$ @D.Kent: Thank you for your clarifications. The link I mentioned at the end of my answer explains in detail how you can extract the actual basis functions. Did you have a look at it? If anything in there is unclear, perhaps you can come back to this forum with specific questions about what you don't understand. See the section Basis Functions of that link. $\endgroup$ Mar 18, 2019 at 0:35
  • 1
    $\begingroup$ I can see from the article how the basis functions are plotted. What I don't see is the code that produces the actual equation for the basis function. For example is s(x).2 simply "x^2"? $\endgroup$
    – D. Kent
    Mar 18, 2019 at 1:59
  • 1
    $\begingroup$ Hmmm . . . from the post below, I am wondering if the answer to my question below is the actual basis equations cannot be produced from R. Which would really be unfortunate. stackoverflow.com/questions/43851861/… $\endgroup$
    – D. Kent
    Mar 18, 2019 at 2:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.