Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
RoelVerbelen opened this issue Jan 26, 2023 · 1 comment

Comments

@RoelVerbelen
Copy link

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
Copy link
Author

Current workaround would be:

library(dplyr)

result %>% 
  filter(Component == "conditional") %>% 
  plot()

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant