see icon indicating copy to clipboard operation
see copied to clipboard

Option to only select fixed effects when plotting paramters of `gam()` model

Open RoelVerbelen opened this issue 1 year ago • 1 comments

The plot of the smooth terms if empty and not useful.

Worthwhile considering removing this altogether or perhaps extending the use of the compoment argument to select only fixed effects (e.g. plot(result, component = "conditional"))?

library(parameters)
library(mgcv)
#> Loading required package: nlme
#> This is mgcv 1.8-39. For overview type 'help("mgcv-package")'.
m <- gam(mpg ~ s(wt) + cyl + gear + s(disp), data = mtcars)
result <- model_parameters(m)
result
#> # Fixed Effects
#> 
#> Parameter   | Coefficient |   SE |         95% CI | t(20.48) |      p
#> ---------------------------------------------------------------------
#> (Intercept) |       31.22 | 4.54 | [21.77, 40.67] |     6.88 | < .001
#> cyl         |       -2.04 | 0.70 | [-3.50, -0.58] |    -2.91 | 0.008 
#> gear        |        0.40 | 0.58 | [-0.80,  1.61] |     0.70 | 0.494 
#> 
#> # Smooth Terms
#> 
#> Parameter          |    F |   df |     p
#> ----------------------------------------
#> Smooth term (wt)   | 4.81 | 1.00 | 0.040
#> Smooth term (disp) | 5.39 | 7.52 | 0.001
plot(result)
#> Warning: Removed 2 rows containing missing values (`geom_point()`).

Created on 2023-01-27 by the reprex package (v2.0.1)

RoelVerbelen avatar Jan 26 '23 23:01 RoelVerbelen