| nl_r2 | R Documentation |
Computes a suite of R-squared statistics for models fitted by
nl_fit.
For single-level models the standard R-squared and adjusted R-squared are
returned. For multilevel models (lmerMod / glmerMod) two quantities are
reported: the Nakagawa-Schielzeth marginal R-squared (variance explained by
fixed effects only) and the conditional R-squared (fixed plus all random
effects), together with a level-specific variance partition table analogous
to the r2_mlm / Raudenbush-Bryk approach.
nl_r2(object, digits = 4L)
object |
An |
digits |
Integer; decimal places for display. Default |
Marginal and conditional R-squared for LMMs follow the Nakagawa and
Schielzeth (2013) formulae extended to multiple random effects by Nakagawa,
Johnson and Schielzeth (2017). The fixed-effects variance
\sigma^2_f is computed as the variance of the linear predictor
from fixed effects only (\hat{\mu} = X\hat{\beta}).
The level-specific variance partition (r2_mlm-style) decomposes the total
modelled variance (\sigma^2_f + \sum \sigma^2_j + \sigma^2_\epsilon)
to show how much each source contributes, printed as a breakdown table.
A list of class "nl_r2" returned invisibly and
pretty-printed automatically. It contains type (one of
"OLS", "GAM", "LMM", or "GLMM"),
r2 (a named numeric vector: R2 and R2_adj for OLS;
R2_dev for GAM; R2m and R2c for LMM/GLMM), and
variance_partition (a data frame with columns component,
variance, and proportion for multilevel models, or
NULL for single-level models).
Nakagawa, S., & Schielzeth, H. (2013). A general and simple method for obtaining R-squared from generalized linear mixed-effects models. Methods in Ecology and Evolution, 4(2), 133–142.
Nakagawa, S., Johnson, P. C. D., & Schielzeth, H. (2017). The coefficient of determination R-squared and intra-class correlation coefficient from generalized linear mixed-effects models revisited and expanded. Journal of the Royal Society Interface, 14(134), 20170213.
Rights, J. D., & Sterba, S. K. (2019). Quantifying explained variance in multilevel models: An integrative framework for defining R-squared measures. Psychological Methods, 24(3), 309–338.
nl_fit, nl_icc
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.