Calculate the R2 value for different model objects. Depending on the model, R2, pseudo-R2 or marginal / adjusted R2 values are returned.

r2(model, ...)

# S3 method for merMod
r2(model, tolerance = 1e-05, ...)

Arguments

model

A statistical model.

...

Arguments passed down to the related r2-methods.

tolerance

Tolerance for singularity check of random effects, to decide whether to compute random effect variances for the conditional r-squared or not. Indicates up to which value the convergence result is accepted. When r2_nakagawa() returns a warning, stating that random effect variances can't be computed (and thus, the conditional r-squared is NA), decrease the tolerance-level. See also check_singularity.

Value

Returns a list containing values related to the most appropriate R2 for the given model. See the list below:

See also

Examples

model <- glm(vs ~ wt + mpg, data = mtcars, family = "binomial") r2(model)
#> $R2_Tjur #> Tjur's R2 #> 0.4776926 #>
if (require("lme4")) { model <- lmer(Sepal.Length ~ Petal.Length + (1 | Species), data = iris) r2(model) }
#> # R2 for Mixed Models #> #> Conditional R2: 0.969 #> Marginal R2: 0.658