It's been a while I fitted GAMs, but I always find interpreting smooth terms to be somewhat confusing because there is no positive or negative sign for co-efficients. The plot does not always show a clear upward or downward trend. I always double check GAM output by fitting the same model using GLM or another non-linear model. For instance, I fit the following model in R

mod1 <- gam(severity ~  s(mean_rh, k = 8) + s(mean_temp, k = 10) + s(mean_ws, k =7) + s(avg_daily_rain, k = 7), family = betar(),  data = dat_seasonal)


Here is the output:

disease_severity ~ s(mean_rh, k = 8) + s(mean_temp, k = 10) + 
    s(mean_ws, k = 7) + s(avg_daily_rain, k = 7)

Parametric coefficients:
            Estimate Std. Error z value Pr(>|z|)
(Intercept)  -0.1687     0.1374  -1.228    0.219

Approximate significance of smooth terms:
                    edf Ref.df Chi.sq  p-value    
s(mean_rh)        1.000  1.000   2.76 0.096633 .  
s(mean_temp)      4.231  4.598  74.22  < 2e-16 ***
s(mean_ws)        2.461  2.673  17.53 0.000669 ***
s(avg_daily_rain) 1.000  1.000  49.89  < 2e-16 ***
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

R-sq.(adj) =  0.847   Deviance explained = 91.8%
-REML = -29.205  Scale est. = 1         n = 37

The model output suggests that mean_temp, mean_ws and avg_daily_rain are significant, but there is no information on whether the effect is negative or positive.

Here is the plot:

plot(mod1, pages = 1, all.terms = TRUE, rug = TRUE, residuals = TRUE, pch = 1, cex = 1, shade = TRUE, seWithMean = TRUE, shift = coef(mod1)[1])

From the plot it's clear that mean_temp and avg_daily_rain have a significant positive effect. But what about mean_ws? The curve is going up from wind speed up to a wind value of 1.3, and then the curve is almost flat from 1.3 to 1.6. I can only guess that the effect is negative. DHARMa residuals are fine and the gam.check() output is also okay. Thank you!


1 Answer 1


Coefficients in GAMs

First off, the coefficients definitely can be negative. I think you are confusing the coefficients with the edf terms. As an example, I have fit this model with the mcycle data from the MASS package to show you.


fit <- gam(accel ~ s(times),
           data = MASS::mcycle,
           method = "REML")


Shown below:

(Intercept)  s(times).1  s(times).2  s(times).3  s(times).4  s(times).5 
 -25.545865  -63.799013   41.202002 -109.827071  -23.305431   35.132376 
 s(times).6  s(times).7  s(times).8  s(times).9 
  90.759312   -8.721425 -106.596311   17.592814 

You can see that in fact many of the coefficients are positive and many are negative.

Model Summary and Plots

However, I don't find this information is super useful for your purpose. The rest of the information you usually get from mgcv summary and plots is far more useful if you are looking for a meaningful interpretation.

The edf part of the summary is your expressive degrees of freedom and indicates how curvilinear your predictor is. This alone doesn't say much about the direction of the relationship, only how straight the line should be. You can see this with the two edfs of 1. While they have the same curvilinearity, their plots show one has a positive relationship and the other has a negative relationship. Here so far your interpretation is correct.

However, what you said about mean_ws is wrong. I show it here by itself so its more clear:

enter image description here

It is not negative, or rather it is not at least strictly negative (it does slightly taper off but not dramatically). Without knowing how wind speed normally works, I can see that it begins to have a positive relationship, and then has a plateau effect. Something may be theoretically influencing the relationship once it gets to 1.3, and then the relationship between the two variables has a flattening effect. Saying it is negative implies that this relationship continuously decreases your DV.

However, there are two caveats here, and I have circled what I mean in the plot.

enter image description here

First, the point where the data plateaus seems to have a high level of clustering of points there, so I would look into why that is happening. Second, the far right has far less data compared to the cluster on the left, so I would see why this is, as it may signify why the relationship looks this way. Consider if you have 100 data points at the left cluster and 1 data point on the right cluster that has a much lower value, this would cause an artificial bend in your GAM curve. This is actually why the standard error shading is larger at the end, because this part of your regression becomes less accurate with less data. So while this isn't a problem for your regression per se, it may be worth looking into why this relationship exists.

  • 1
    $\begingroup$ I'm not sure if you read all of my answer, but I already mentioned that the relationship is not negative. It is first positive and then plateaus. You could say it diminishes slightly after the first cluster of data points but I think saying it is strictly negative is pretty inaccurate. It is also not useful to compare your coefficients from a GLMM to a GAM. First, the GLMM could be "drawing a line" where it isn't supposed to be. Second, that regression includes random effects terms whereas this one doesn't. $\endgroup$ Jan 29, 2023 at 2:09
  • $\begingroup$ If you are having issues interpreting a GAM, I would check out this useful course: noamross.github.io/gams-in-r-course $\endgroup$ Jan 29, 2023 at 2:12
  • $\begingroup$ I don't see the complication. The relationship is positive and linear, then flatlines. There isn't much more to say about it. The whole point behind a GAM is that it models complex behavior between predictors and outcomes. Terms with EDFs higher than one are not supposed to have a singular explanation. $\endgroup$ Jan 29, 2023 at 2:15
  • $\begingroup$ How would you interpret the regression that I provided with the mcycle data? This is covered in the GAM course and should highlight what the purpose behind GAMs is supposed to be. Hint: the relationship is neither positive or negative and models test dummy motorcycle crash data (acceleration of the head in g force by time in milliseconds). $\endgroup$ Jan 29, 2023 at 3:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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