Skip to content
Prev 4885 / 5636 Next

[R-meta] Specifying variable names in metafor::vec2mat()

Hello Everyone,

I'm using the metafor::vec2mat() as shown in the toy example below.
However, I wonder how I should specify the order of the variables' names
defined in "dimnames=" when converting the vector of coefficients to a
correlation matrix using metafor::vec2mat()?

Is there generally a rule or a technique to order the variables' names
correctly in "vec2mat()", especially if there are many variable names?

Thanks,
Yuhang

# EXAMPLE:
tmp <- rcalc(ri ~ var1 + var2 | study, ni=ni, data=dat.craft2003)
V <- tmp$V
dat <- tmp$dat

res <- rma.mv(yi~ var1.var2 - 1, V,
              random = ~  var1.var2| study, struct = "UN",
              data=dat)

vec2mat(coef(res), dimnames= ??????)