Skip to content

metafor- interpretation of moderators test for raw proportions

1 message · Viechtbauer Wolfgang (STAT)

#
Just to follow up on what Michael wrote:
I cannot reproduce that error. For example, this all works as intended:

data(dat.bcg)

dat <- escalc(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg, append=TRUE)

rma(yi, vi, mods = ~ alloc, data=dat) ### 'alloc' automatically converted to a factor

dat$alloc <- factor(dat$alloc) ### explicitly make 'alloc' a factor

rma(yi, vi, mods = ~ alloc, data=dat) ### works as before

rma(yi, vi, mods = ~ factor(alloc), data=dat) ### factor() not necessary, but works

If you can provide a reproducible example, I'll be glad to look into the issue.

Aside from that, the error you got occurs when the design matrix is not of full rank. For example:

X <- model.matrix(~ factor(alloc) - 1, data=dat)
rma(yi, vi, mods = X, data=dat)

will fail, because the model now has an intercept plus the 3 dummy variables for the 3 levels (setting intercept=FALSE will make this work). It seems to me that this is what happened (since in your previous post, you showed that you coded the three levels of your factor manually). But this is something different than what you describe below, so I don't know for sure.

Best,

Wolfgang