tips:i2_multilevel_multivariate
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
tips:i2_multilevel_multivariate [2021/01/06 11:02] – Wolfgang Viechtbauer | tips:i2_multilevel_multivariate [2022/03/18 09:48] – Wolfgang Viechtbauer | ||
---|---|---|---|
Line 26: | Line 26: | ||
<code rsplus> | <code rsplus> | ||
k <- res$k | k <- res$k | ||
- | wi <- 1/dat$vi | + | wi <- 1/res$vi |
vt <- (k-1) * sum(wi) / (sum(wi)^2 - sum(wi^2)) | vt <- (k-1) * sum(wi) / (sum(wi)^2 - sum(wi^2)) | ||
100 * res$tau2 / (res$tau2 + vt) | 100 * res$tau2 / (res$tau2 + vt) | ||
Line 40: | Line 40: | ||
Let's try this out for the example above: | Let's try this out for the example above: | ||
<code rsplus> | <code rsplus> | ||
- | W <- diag(1/dat$vi) | + | W <- diag(1/res$vi) |
X <- model.matrix(res) | X <- model.matrix(res) | ||
P <- W - W %*% X %*% solve(t(X) %*% W %*% X) %*% t(X) %*% W | P <- W - W %*% X %*% solve(t(X) %*% W %*% X) %*% t(X) %*% W | ||
Line 103: | Line 103: | ||
Based on the discussion above, it is now very easy to generalize the concept of $I^2$ to such a model (see also Nakagawa & Santos, 2012). That is, we can first compute: | Based on the discussion above, it is now very easy to generalize the concept of $I^2$ to such a model (see also Nakagawa & Santos, 2012). That is, we can first compute: | ||
<code rsplus> | <code rsplus> | ||
- | W <- diag(1/dat$vi) | + | W <- diag(1/res$vi) |
X <- model.matrix(res) | X <- model.matrix(res) | ||
P <- W - W %*% X %*% solve(t(X) %*% W %*% X) %*% t(X) %*% W | P <- W - W %*% X %*% solve(t(X) %*% W %*% X) %*% t(X) %*% W |
tips/i2_multilevel_multivariate.txt · Last modified: 2022/10/24 10:10 by Wolfgang Viechtbauer