6
$\begingroup$

How are parametric coefficients interpreted in the summary of a GAM? and does this change if the model also includes smooth terms?

Lets take an example from Simon Woods book Generalized additive models: an introduction with R; Second edition. On pages 189-190 he talks about parametric model terms (section 4.6.3). The example given looks at the associations between tree volume, height and girth. The outcome of the model is the continuous variable tree volume. Tree height is a factor (small, medium, large) variable and is fitted as a parametric term and tree girth is a continuous variable fitted as a smooth term.

gam(Volume ~ Hclass + s(Girth), family = Gamma(link = log), data = trees)

The model summary for this model is below

Family: Gamma
Link function: log

Formula:
Volume ~ Hclass + s(Girth)

Parametric coefficients:
            Estimate   Std. Error     t value     Pr(>|t|)
(Intercept)  3.12693      0.04814      64.949     < 2e-16 ***
Hclassmedium 0.13459      0.05428      2.479      0.020085 *
Hclasslarge  0.23024      0.06137      3.752      0.000908 ***

Approximate significance of smooth terms:
           edf   Est.rank          F       p-value
s(Girth) 2.414      9.000      54.43      1.98e-14 ***

R-sq.(adj) = 0.967 Deviance explained = 96.9%
GCV score = 0.012076 Scale est. = 0.0099671 n = 31

In a regular linear model the interpretation of the parametric coefficients would be that the volume of medium sized trees is 0.13459 units larger than the volume of small trees and similarly the volume of large tree is 0.23024 units larger than small trees. This interpretation is on the scale of the link function.

Is this interpretation different in a GAM and does this change in the presence of smooth functions? Also would this interpretation of parametric coefficient change if we included an interaction term in the model that included Hclass, for example if we included the term s(Girth, by = Hclass) in the model?

$\endgroup$

2 Answers 2

3
$\begingroup$

On the interaction part only (as the first part of @jérémy Gelb's answer addresses the main part of the OP's question), adding the interaction by a factor by smooth also doesn't change the interpretation of the model coefficients.

Consider the model:

gam(y ~ f + s(x, by = f)

What mgcv is doing when it is passed a factor to the by argument is set up an (almost) entirely separate smooth for each level of the factor f. What this means in practice is that we get k columns (actually k minus however many functions are removed due to identifiability constraints, which is 1 here in this and the OP's example) added to the model matrix for each level of f. The columns for the $j$th level of the factor f are non-zero, taking the values of the basis functions evaluated at the values of the covariate x for each row, if that row belongs to the $j$th level of the factor and 0 otherwise. If we were to order the observations by levels of f, the thing added to the model matrix would be a block diagonal matrix with zeroes everywhere except for the rows and columns that refer to the $j$th level of the factor.

The reason you need to include f as a parametric term in this model is because there is nothing in the s(x, by = f) part of the model that represents the group means of the response, as each of the smooths associated with the factor-by term are centred due to the imposition of the identifiability constraints.

$\endgroup$
1
  • $\begingroup$ Thanks @Gavin Simpson. Is it then valid to interpret the coefficients of the parametric factor in a model such as above - gam(y ~ f + s(x, by = f)? Or would you only interpret the smooths? Often if the interaction in a model is significant you would not interpret the coefficients of the main terms separately, does this apply? $\endgroup$ Commented Jun 24, 2021 at 22:51
2
$\begingroup$

First of all, be very careful with your coefficient interpretation. In your first sentence, it seems that you get it wrong, even if you add "This interpretation is on the scale of the link function" right after. Your model uses a Gamma distribution and a log link function. In that setting, an increase of one unit of Hclassmedium would increase the expected value by 0.13 on the log scale. You could transform the parameter by applying the exponential function (exp) to say that an increase of 1 unit of Hclassmedium would multiply by 1.14 the expected value of Volume on its original scale. This is not a detail.

Second, adding a smooth term without interaction does not affect the interpretation of the coefficients because their calculation is not directly affected by the smooth term. Just keep in mind the "Ceteri Paribus" principle.

The interaction is more tricky. What you obtain with the formula s(Girth, by = Hclass) is a varying coefficient for Hclass along the variable Girth. Note that it does not model the impact of Girth on Y. In the s function documentation, it is indicated that:

For the numeric by variable case the resulting smooth is not usually subject to a centering constraint (so the by variable should not be added as an additional main effect)

So you should probably avoid adding the Hclass in both the parametric formula and the spline.

$\endgroup$
2
  • 1
    $\begingroup$ The last part of your answer (everything from "The interaction is more tricky") about the varying coefficient is not correct; you are confusing what is done if the by variable were a numeric vs what is done when it is a factor as is the case here. When fitting a factor by smooth term you very much do need the parametric factor term included because the smooths are centred so don't include the Hclass group means. $\endgroup$ Commented Jun 23, 2021 at 10:51
  • 1
    $\begingroup$ You are right, Thank you for the additional information. I do not know why I was convinced that Hclass was numeric. $\endgroup$ Commented Jun 23, 2021 at 16:07

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.