I have been evaluating the quality of modelfit with the easystats package (0.7.1.3). Since I have mixed models I use the r2_nakagawa() function and since the last update I did (easystats::install_latest(force = TRUE)) this function gives me strange values.
For example for this model:
m2<-glmmTMB(FvFm ~ hora*temperatura + (1|Experimento), data=d, family=beta_family(link="logit"))
I used to get these values:
r2_nakagawa(m2)
# R2 for Mixed Models
Conditional R2: 1.000
Marginal R2: 0.973
and now (with the latest update) it gives me these values:
# R2 for Mixed Models
Conditional R2: 1.341
Marginal R2: 1.306
I don't know what's wrong, but I have the latest version of easystats and performance and insight.
Someone is having these problems, I think it is not code. Any help is welcome and appreciated!!
I tried to install previous versions of easystats, but the values for R2 did not change.
Please see this issue on GitHub for the insight package, which is internally used to compute the r-squared values: https://github.com/easystats/insight/issues/889
We have revisited the function and intensively tested against all examples from the Nakagawa et al. paper and against results from other R packages that compute r-squared for mixed models.
Thereby, we finally could improve the accuracy (or correct the computation) for some families, including the Beta-family. You can check your results by installing the latest development versions from GitHub, which you can do in two ways:
install.packages("insight", repos = "https://easystats.r-universe.dev")
install.packages("performance", repos = "https://easystats.r-universe.dev")
easystats::install_latest(force = TRUE)
.Then try r2_nakagawa(m2)
again. The update documentation for r2_nakagawa()
is also much clearer about the validated and working-but-not-fully-validated model families.
Furthermore, it is now possible to calculate r-squared values based on different approximations for the distribution-specific variance component, using log-normal, delta or trigamma approximations (as proposed by Nakagawa et al., and also implemented in the MuMIn package); see the new approximation
argument.
References