Skip to content
Prev 1363 / 5632 Next

[R-meta] Random Effect for Continuous Moderator in Three-Level Meta-Analysis

Hi Wolfgang,

Thanks for the quick response and the sample code. I'll try it out!

Best,

Andrew

Andrew C. Loignon
Assistant Professor
2716 Business Education Complex
Rucks Department of Management
E. J. Ourso College of Business
Louisiana State University
Baton Rouge, LA 70808
Email: aloignon at lsu.edu
Phone: 225-578-6148

-----Original Message-----
From: Viechtbauer, Wolfgang (SP) <wolfgang.viechtbauer at maastrichtuniversity.nl> 
Sent: Thursday, January 10, 2019 17:47
To: Andrew Loignon <aloignon at lsu.edu>; r-sig-meta-analysis at r-project.org
Subject: RE: Random Effect for Continuous Moderator in Three-Level Meta-Analysis

Hi Andrew,

Yes, this is possible if you install the 'devel' version of metafor. It includes an as-of-yet undocumented 'struct' option, namely "GEN". This allows for random effects terms, such as:

~ x1 + x2 + ... | factor

where x1, x2, and so on can be continuous (but also categorical) variables. So, for the example you used, it would be:

m2.ml <- rma.mv(yi, vi,
                random = ~ I(year-1990.591)| district, struct="GEN",
                method="ML",
                digits = 3,
                data=dat.konstantopoulos2011)

BUT:

1) Unless you want to assume that the average slope is 0, one should also include the same predictor as a fixed effect:

m2.ml <- rma.mv(yi, vi, mods = ~ I(year-1990.591),
                random = ~ I(year-1990.591)| district, struct="GEN",
                method="ML",
                digits = 3,
                data=dat.konstantopoulos2011)

2) 'year' is actually constant within districts, so the use of random slopes for this predictor doesn't make much sense.

Note: The "GEN" structure is undocumented, which implies that this feature is really still in the testing phase.

Best,
Wolfgang