R – Best Way to Get R-squared Values from Linear Mixed Effects Models

mixed modelr

What is the best way to get the R2 values from linear mixed effects models?

I also saw this post before posting this: https://stackoverflow.com/questions/45327217/r-squared-of-lmer-model-fit. However, this post made me concerned about using Nakagawa & Schielzeth's (2013) R2glmm method link: (https://stackoverflow.com/questions/45327217/r-squared-of-lmer-model-fit). Is this method the "generally" agreed-upon way to get R-2 for linear mixed models with random effects?

Any help at all would be greatly appreciated!

Best Answer

The r2() function from sjPlot is implemented in r2_nakagawa() in package performance.

I think the approach from Nakagawa et al. is feasible and you can generally use it, as long as you acknowledge possible limitations. There's some discussion about R2 in mixed models, which might help you deciding if/what you would like to use:

http://bbolker.github.io/mixedmodels-misc/glmmFAQ.html#how-do-i-compute-a-coefficient-of-determination-r2-or-an-analogue-for-glmms

https://afex.singmann.science/forums/topic/compute-effect-sizes-for-mixed-objects#post-295