easystats / see

:art: Visualisation toolbox for beautiful and publication-ready figures
https://easystats.github.io/see/
Other
891 stars 45 forks source link

supporting `mgcv::gam` models in `check_model` #103

Open IndrajeetPatil opened 3 years ago

IndrajeetPatil commented 3 years ago

Came across this slide in this presentation: https://chrismainey.github.io/Why_mgcv_is_awesome/Why_data_table_is_awesome.html#1

Screenshot 2021-03-25 at 15 40 13

and thought maybe we can also support something similar in check_model?

library(mgcv)
#> Loading required package: nlme
#> This is mgcv 1.8-33. For overview type 'help("mgcv-package")'.
set.seed(0)
dat <- gamSim(1, n = 200)
#> Gu & Wahba 4 term additive model
b <- gam(y ~ s(x0) + s(x1) + s(x2) + s(x3), data = dat)

library(performance)

check_model(b)
#> Error in data.frame(Parameter = terms, VIF = result, SE_factor = sqrt(result), : arguments imply differing number of rows: 0, 1

Created on 2021-03-25 by the reprex package (v1.0.0)

DominiqueMakowski commented 3 years ago

imho GAMs are the future of psych stats (I predict that it'll be the next big thing after the [still] current mixed model wave), so providing good support for them across easystats is a good bet

strengejacke commented 2 years ago

It works, but I can't say how sensible / valid the results are, since I simply used the same approach as for (g)lm's when computing qq-plots etc.

strengejacke commented 2 years ago
library(mgcv)
#> Loading required package: nlme
#> This is mgcv 1.8-38. For overview type 'help("mgcv-package")'.
library(performance)

set.seed(0)
dat <- gamSim(1, n = 200)
#> Gu & Wahba 4 term additive model
b <- gam(y ~ s(x0) + s(x1) + s(x2) + s(x3), data = dat)
check_model(b)

Created on 2022-02-26 by the reprex package (v2.0.1)

We probably could ask Gavin Simpson here?

bwiernik commented 2 years ago

Let's swap out the qq plot for a dharma qq plot and I think we are good