Skip to content

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

1 message · Yuhang Hu

#
Thank you, Wolfgang. I figured something out for `coef(res)` order. But
should `vcov(res)` also follow/match the changes that happen in the order
of `coef(res)`, if the user wants to eventually use both as input in
`matreg()`?

# EXAMPLE:
dat <- dat.craft2003
dat$var1.var2 <- apply(dat[c("var1","var2")],1,paste0,collapse=".")

res <- rma(ri~var1.var2+0, 1, data=dat)

rs <- coef(res)[c(3,5,6,1,2,4)] # vs.  rs <- coef(res)

r_mat = vec2mat(rs, dimnames=c("perf","acog","asom","conf")) # vs.
c("acog","asom","conf","perf")

v_mat = vcov(res) ## How should this change if: rs <- coef(res)?

matreg("perf", c("acog","asom"), R=r_mat, V=v_mat)

Many thanks for your knowledge,
Yuhang
On Wed, Sep 13, 2023 at 1:40?PM Yuhang Hu <yh342 at nau.edu> wrote: