Learn R Programming

orchaRd (version 2.2.1)

r2_ml: r2_ml

Description

R2 (R-squared) for mixed (mulitlevel) models, based on Nakagawa & Schielzeth (2013).

Usage

r2_ml(model, data, boot = NULL)

Value

A data frame containing all model results, including: mean effect size estimate, confidence and prediction intervals, with estimates converted back to r.

Arguments

model

Model object of class rma.mv or rma.

data

Data frame used to fit the rma.mv or rma model object

boot

The number of parametric bootstrap iterations, if desired. Defaults to NULL. A setting of 1000 is recommended as a minimum number of iterations.

Author

Shinichi Nakagawa - s.nakagawa@unsw.edu.au

Daniel Noble - daniel.noble@anu.edu.au

References

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.

Examples

Run this code
# \donttest{
data(lim)
lim$vi <- (1/sqrt(lim$N - 3))^2
lim_MR <- metafor::rma.mv(
  yi = yi, V = vi, mods = ~ Phylum - 1,
  random = list(~1 | Article, ~1 | Datapoint),
  data = lim)
R2 <- r2_ml(lim_MR, data = lim)
# }

Run the code above in your browser using DataLab