rgammgcvparametric-equationsgratia

How to interpret the partial effect plots for parametric terms while using gratia::draw()?


I am asking a question akin to this one: What does the y-axis "effect" mean after using gratia::draw for a GAM but am wondering the same question for parametric terms not smooths.

My data looks like this:

df<-structure(list(spreg = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L), levels = c("n", "y"), class = "factor"), 
    Landings = c(48974, 16933, 18389, 16433, 5720, 3775, 1388, 
    97109, 148609, 104267, 77454, 128938, 108096, 126957, 102396, 
    16165, 59423, 2892, 4728, 3783, 4785, 11359, 5323, 6106, 
    167, 568, 480, 2208, 4378, 1908), year = c(2007, 2009, 2011, 
    2013, 2015, 2018, 2007, 2007, 2007, 2012, 2015, 2018, 2007, 
    2007, 2012, 2015, 2018, 2008, 2010, 2006, 2008, 2011, 2008, 
    2011, 2007, 2010, 2007, 2014, 2015, 2014)), row.names = c(1L, 
2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 
16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 28L, 29L, 
30L, 31L), class = "data.frame")

My code looks like this:

library(mgcv)
library(gratia)
gam<-gam(Landings~s(year)+spreg,data=df)
draw(parametric_effects(gam))

Partial effect plot looks like this:

enter image description here

I want to report these partial effect plots for parametric terms but I am having trouble finding a good description of the partial effect plots for fixed effects. Is this the estimate and 95% credible interval like the smooth partial effect plots?


Solution

  • The value for the y group is literally the estimated value for the y term shown in the output from summary() (or the estimated value for the coefficient labelled spregy), and the interval is based on the SE shown in that output too. The value for n is 0 as it is the reference level and hence it has 0 partial effect as the intercept term represents this group and the partial effects shown are for deviations from the intercept. I don't find these plots that useful, but plot.gam() showed them so draw() does as it is a ggplot-based alternative to plot.gam().

    The behaviour of plot.gam() and draw() follows (or closely follows) termplot(), with the former literally calling this function for plotting. If you want more useful outputs, packages emmeans or marginaleffects would be my go to options.