# computing heterogeneity assigned to random factors in meta-analysis

I want to calculate the proportion of total variance in a multi-level meta-analysis with 2+ random effect terms according to pp. 1261 & equation (24) in Nakagawa & Santos 2012 https://www.researchgate.net/profile/Shinichi_Nakagawa2/publication/233341316_Methodological_issues_and_advances_in_biological_meta-analysis/links/00b495157aec0585c0000000.pdf

I have the following output from function rma.mv in R package metafor with the model structure

test.meta = rma.mv(d, Var.d., random = list(~1|Study, ~1|Order.class), data=data).


How can I obtain the total heterogeneity (variance) by which to divide each of the sigma^2 terms?

Multivariate Meta-Analysis Model (k = 274; method: REML)

    logLik    Deviance         AIC         BIC        AICc
-1264.4201   2528.8403   2534.8403   2545.6687   2534.9295


Variance Components:

            estim    sqrt  nlvls  fixed       factor
sigma^2.1  1.1223  1.0594     65     no        Study
sigma^2.2  0.4060  0.6372      7     no  Order.class


Test for Heterogeneity:

Q(df = 273) = 2660.6043, p-val < .0001


Model Results:

estimate       se     zval     pval    ci.lb    ci.ub
-0.6585   0.3125  -2.1074   0.0351  -1.2710  -0.0461        *

---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1


A similar example with only one random-effect term is here http://www.metafor-project.org/doku.php/tips:rma.uni_vs_rma.mv under "Random effects model."

First, you need to compute what is denoted $\sigma^2_m$, the 'typical' within-study variance, as defined by Higgins and Thompson (2002). You can do this with:
wi <- 1/test.meta$vi k <- length(wi) s2m <- (k-1)*sum(wi)/(sum(wi)^2 - sum(wi^2))  Then the total variance,$\sigma^2_t$, as defined in Nakagawa and Santos (2012), can be computed with: s2t <- s2m + sum(test.meta$sigma2)

And now you can compute $I^2$-like measures with:
test.meta\$sigma2 / s2t