easystats / performance

:muscle: Models' quality and performance metrics (R2, ICC, LOO, AIC, BF, ...)
https://easystats.github.io/performance/
GNU General Public License v3.0
1.02k stars 90 forks source link

test_performance for GAMMs #201

Open DominiqueMakowski opened 3 years ago

DominiqueMakowski commented 3 years ago

Will try to look into this when I have time:

model1 <- mgcv::gamm(Sepal.Length ~ s(Petal.Width), random=list(Species = ~1), data=iris, family=inverse.gaussian(link = "identity"))
#> 
#>  Maximum number of PQL iterations:  20
#> iteration 1
#> iteration 2
#> iteration 3
model2 <- lme4::glmer(Sepal.Length ~ poly(Sepal.Width, 2) + (1|Species), data=iris, family=inverse.gaussian(link = "identity"))
model3 <- gamm4::gamm4(Sepal.Length ~ s(Petal.Width), random=~(1|Species), data=iris, family=inverse.gaussian(link = "identity"))

performance::test_performance(model1, model2)
#> Name   | Model.model1 | Model.model2
#> ------------------------------------
#> model1 |          lme |     glmerMod
#> model2 |          gam |     glmerMod
#> Models were detected as nested and are compared in sequential order.
performance::test_performance(model1, model3)
#> Warning: Unable to extract terms from the following models: 
#> model3
#> Name   | Model.model1 | Model.model3
#> ------------------------------------
#> model1 |          lme |     glmerMod
#> model3 |          gam |          gam
#> Models were detected as nested and are compared in sequential order.
performance::test_performance(model2, model3)
#> Warning: Unable to extract terms from the following models: 
#> model3
#> Name   | Model.model2 | Model.model3
#> ------------------------------------
#> model2 |     glmerMod |     glmerMod
#> model3 |     glmerMod |          gam
#> Each model is compared to model2.

Created on 2021-02-20 by the reprex package (v0.3.0)

aimundo commented 3 years ago

I was just about to submit an issue about something similar. Out of curiosity, are there any plans regarding making check_model amicable to mgcv::gam models?