[R-meta] Effect coding in metafor

Viechtbauer Wolfgang (SP) wolfgang.viechtbauer at maastrichtuniversity.nl
Mon Feb 26 15:08:20 CET 2018


Dear Yogev,

Here is an extensive discussion of an example with 2 categorical moderators and it happens to be the case that it also involves one dichotomous and one 3 level factor:

http://www.metafor-project.org/doku.php/tips:multiple_factors_interactions

I don't see why you need to change the coding.

Best,
Wolfgang

>-----Original Message-----
>From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces at r-
>project.org] On Behalf Of Yogev Kivity
>Sent: Monday, 26 February, 2018 4:38
>To: r-sig-meta-analysis at r-project.org
>Subject: [R-meta] Effect coding in metafor
>
>Hi all,
>I am running a meta-analysis with 2 categorical moderators, one is
>dichotomous and the other has 3 levels (e.g. x1 and x2). For example:
>rma.mv(yi, V, mods=~factor(x1)*factor(x2), random = ~ 1 |
>StudyID/GroupID/EffectSizeID, data=DataF)
>(the specifics of the design of the meta-analysis seemed irrelevant to
>me, but if I am mistaken, I am happy to provide further details)
>As a first step, I am interested in the main effects of both moderators
>as well as the interaction effect. Therefore, to my understanding, I need
>both moderators to be set as effect coding factors, rather then dummy
>coding factors. However, I could not figure out a way to do it in
>metafor. For example, setting the following contrasts did not work, and
>essentially the output remained identical to that of the dummy variables
>(i.e., each estimate expresses the simple effect of the moderator within
>the reference category of the other moderator):
>contrasts(Data$x1)<-c(-.5,.5)
>
>Obviously, I can get around the problem by creating multiple numeric
>variables with weights that correspond to the desired effect coding, but
>I was wondering whether I am missing something and whether there is a
>more elegant way of doing it.
>Best,Yogev
>--
>
>Yogev Kivity, Ph.D.
>Postdoctoral Fellow
>Department of Psychology
>The Pennsylvania State University
>Bruce V. Moore Building
>University Park, PA 16802
>Office Phone: (814) 867-2330



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