Learn R Programming

orchaRd (version 2.2.1)

R2_calc: R2_calc

Description

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

Usage

R2_calc(model)

Value

A named numeric vector of length two: R2_marginal, the proportion of variance explained by the fixed effects (moderators) alone, and R2_conditional, the proportion explained by both the fixed and random effects. Values range from 0 to 1.

Arguments

model

Model object of class rma.mv or rma.

Author

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

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

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_calc(lim_MR)
# }

Run the code above in your browser using DataLab