For pseudo R2 by cluster, the squared correlation between observed
and predicted values for each cluster unit is returned. For the overall model,
the marginal and conditional R2 are calculated as described in the references.
Usage
R2LMER(model, modelsum, cluster = FALSE)
Arguments
model
A model estimated by lmer.
modelsum
The saved model summary (i.e., summary(model)).
cluster
A logical whether to calculate individual pseudo R2 values by
cluster unit (if TRUE) or the marginal and conditional R2 for the
overall model (if FALSE, the default).
Value
a named vector with the marginal and conditional R2 values,
if CLUSTER = FALSE, otherwise, a data table with the pseudo R2
for each cluster unit.
References
For estimating the marginal and conditional R-squared values,
see: Nakagawa, S. and Schielzeth, H. (2013). A general and simple method
for obtaining R2 from generalized linear mixed-effects models.
Methods in Ecology and Evolution, 4(2), 133-142. as well as:
Johnson, P. C. (2014). Extension of Nakagawa & Schielzeth's R2GLMM to
random slopes models. Methods in Ecology and Evolution, 5(9), 944-946.