[R-meta] meta-regression: categorical

Viechtbauer, Wolfgang (SP) wolfgang.viechtbauer at maastrichtuniversity.nl
Tue Apr 24 12:25:46 CEST 2018


Hi Roberto,

If you put a character variable (or a factor) into a formula, it is automatically dummy coded. Actually, the type of coding depends on:

options("contrasts")

But the default for that is:

        unordered           ordered 
"contr.treatment"      "contr.poly"

And help(contr.treatment) explains what kind of coding this is, namely the 'usual' dummy coding where one level is the 'reference' level (and whose dummy gets omitted).

Best,
Wolfgang

-----Original Message-----
From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces at r-project.org] On Behalf Of P. Roberto Bakker
Sent: Tuesday, 24 April, 2018 11:14
To: r-sig-meta-analysis at r-project.org
Subject: [R-meta] meta-regression: categorical

Hi everybody,

In:
http://www.metafor-project.org/doku.php/analyses:vanhouwelingen2002
'allocation' is put in syntax without dummy coding

rma <http://finzi.psych.upenn.edu/library/metafor/html/rma.uni.html>(yi,
vi, mods = ~ alloc, data
<http://stat.ethz.ch/R-manual/R-devel/library/utils/html/data.html>=dat,
method="ML")

If I am not wrong, 'allocation' is a catergorical variabel, and I suppose
the R handles the coding of dummy automatically.
Correct?

I found this information in:
https://cran.r-project.org/web/packages/metafor/metafor.pdf
*Categorical moderator variables can be included in the model via the mods
argument in the same way that appropriately (dummy) coded categorical
independent variables can be included in linear models. One can either do
the dummy coding manually or use a model formula together with the factor
function to let R handle the coding automatically.   *

*Best wishes and thank you in advance*
*Roberto*



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