r2_ml: r2_ml

View source: R/r2_ml.R

r2_mlR Documentation

r2_ml

Description

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

Usage

r2_ml(model, data, boot = NULL)

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.

Value

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

Author(s)

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

## Not run: 
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, boot = 10)

## End(Not run)

daniel1noble/orchaRd documentation built on May 12, 2024, 7:46 a.m.