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

Yuhang Hu yh342 @end|ng |rom n@u@edu
Mon Sep 11 05:32:26 CEST 2023


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= ??????)

	[[alternative HTML version deleted]]



More information about the R-sig-meta-analysis mailing list