Skip to content
Prev 4888 / 5636 Next

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

Given the ordering of the coefficients in coef(res), this won't be possible. Look at:

print(res, num=TRUE) 

Note that coefficients 1-6 and 18 all pertain to the correlation between L2DA and the other 7 variables. These should all be together in the same column, but

vec2mat(coef(res))

doesn't know that and so coefficient 18 ends up in the wrong place. This is what I tried to explain in my previous post. First, you need to ensure that the ordering of the coefficients is such that filling them in (columnwise) into the matrix makes sense.

So you first need to rearrange the coefficients so that the first set pertains to L2DA (there are 7 of those), then the second set contains the remaining coefficients that pertain to say variable L2DF (there are 6 of those), and so on. Within each set, the order of the variables also needs to be consistent, so if you start with L2DA.L2DF, L2DA.L2G, L2DA.L2L, ..., in the first set, then the second set must start with L2DF.L2G, L2DF.L2L, ..., and so on.

Once you understand this, then setting the appropriate dimension names is obvious.

Best,
Wolfgang