I am asking a question akin to this one: https://stackoverflow.com/questions/71884457/what-does-the-y-axis-effect-mean-after-using-gratiadraw-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 = c("ordered",
"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:
This is what summary(gam)
looks like:
Family: gaussian
Link function: identity
Formula:
Landings ~ s(year) + spreg
Parametric coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 30460 11178 2.725 0.0112 *
spreg.L -16964 15961 -1.063 0.2974
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Approximate significance of smooth terms:
edf Ref.df F p-value
s(year) 1.374 1.652 0.229 0.798
R-sq.(adj) = -0.00914 Deviance explained = 7.35%
GCV = 2.6732e+09 Scale est. = 2.3726e+09 n = 30
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?
y
group is literally the estimated value for they
term shown in the output fromsummary()
, and the interval is based on the SE shown in that output too. The value forn
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, butplot.gam
showed them sodraw()
does as it is a ggplot-based alternative toplot.gam
. $\endgroup$spreg
is the ordered factor? Can you add the output fromsummary(gam)
to your question? Or is the plot shown based on the subset of data you provided? If the latter I can take a look directly myself tomorrow $\endgroup$summary(gam)
to the question. $\endgroup$spreg
is the ordered factor. $\endgroup$