[R-meta] equivalence of weighted regression and MA in the context of complex models

Viechtbauer, Wolfgang (NP) wo||g@ng@v|echtb@uer @end|ng |rom m@@@tr|chtun|ver@|ty@n|
Tue Apr 4 09:19:01 CEST 2023

A note about this:

>res.ml.lm <- lm(yi ~ vi, weights = rowSums(solve(vcov(res.ml,type="obs"))), dat = dat)

What you are doing here is using 'row sum weights', which you can also get directly from weights():

wi <- weights(res.ml, type="rowsum")
res.ml.lm <- lm(yi ~ 1, weights = wi, dat = dat) 

This is described in detail here:


I would be interested to hear under what circumstances 'multiplicative heterogeneity' is useful.


>-----Original Message-----
>From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces using r-project.org] On
>Behalf Of Yefeng Yang via R-sig-meta-analysis
>Sent: Tuesday, 04 April, 2023 5:30
>To: James Pustejovsky; R Special Interest Group for Meta-Analysis
>Cc: Yefeng Yang
>Subject: Re: [R-meta] equivalence of weighted regression and MA in the context of
>complex models
>Hi James,
>Thanks for providing insights and this blog, which is very comprehensive and
>useful (actually, I am a big fan of your blog website). Additive heterogeneity
>and multiplicative heterogeneity is an interesting topic in the context of meta-
>analysis. I know many people are against multiplicative heterogeneity, but it is
>useful in some (important) circumstances - this is what I want to illustrate in
>my paper. Regarding the matrix notation, I know matrix notation is more elegant.
>The word "best" I used in my previous email is restricted to question because I
>want to know how to represent model coefficients estimated from the multilevel
>model using summation notation - it is not meant that matrix notation is not
>good. Sorry for the confusion.
>Actually, I am going to write to you to consult with you about how to properly
>calculate robust cluster errors for weighted regression (or weighted lease
>square), which is fitted by lm() with the weight argument. I saw one of your
>illustrations using the target argument in coef_test() to account for weights
>when calculating robust SE and doing corresponding hypothesis testing (I did not
>find the description of this argument in the package documentation). I am curious
>about your general recommendation of how to use the combination of weighted
>regression and robust variance estimation (which is implemented in clubsandwhich
>From: James Pustejovsky <jepusto using gmail.com>
>Sent: Tuesday, 4 April 2023 12:09
>To: R Special Interest Group for Meta-Analysis <r-sig-meta-analysis using r-
>Cc: Yefeng Yang <yefeng.yang1 using unsw.edu.au>
>Subject: Re: [R-meta] equivalence of weighted regression and MA in the context of
>complex models
>On my first point, I explore the case of meta-regression where the predictors
>vary only at the top level of the model in this post:
>On Mon, Apr 3, 2023 at 9:06 PM James Pustejovsky
><jepusto using gmail.com<mailto:jepusto using gmail.com>> wrote:
>Hi Yefeng,
>Comments inline below.
>On Mon, Apr 3, 2023 at 8:27 PM Yefeng Yang via R-sig-meta-analysis <r-sig-meta-
>analysis using r-project.org<mailto:r-sig-meta-analysis using r-project.org>> wrote:
>Hi all,
>I am working on one paper, in which I want to show the equivalence of weighted
>regression and random-effects meta-analysis in the context of the multilevel
>model. Basically, it is an extension of Wolfgang's bloghttp://www.metafor-
>The intercept-only model works very well. We can get the same model coefficients
>(estimated fixed effect or intercept beta0) from the two models:
>dat <- dat.konstantopoulos2011
># meta-analysis
>res.ml<http://res.ml> <- rma.mv<http://rma.mv>(yi, vi, random = list(~1|district,
>~1|study), test = "t", data=dat)
>res.ml.lm <- lm(yi ~ 1, weights = rowSums(solve(vcov(res.ml<http://res.ml>,
>type="obs"))), dat = dat)
>If I do a post-hoc adjustment to the SE(beta0) of res.ml<http://res.ml>, we can
>get the same SE from res.ml.lm:
>However, when I was working on meta-regression, it did not work. see the below
># regression with vi as a predictor
>res.mr<http://res.mr> <- rma.mv<http://rma.mv>(yi, vi, random = list(~1|district,
>~1|study), mods = ~ vi, test = "t", data=dat)
>res.ml.lm <- lm(yi ~ vi, weights = rowSums(solve(vcov(res.ml<http://res.ml>,
>type="obs"))), dat = dat)
>This is a key illustration of my working paper. Hopefully, I can get some help
>from here, especially from Wolfgang.
>It is not possible to represent this model as a weighted linear regression within
>the scope of lm(). The rma.mv<http://rma.mv>() estimator uses generalized least
>squares with block-diagonal weight matrices and it is not generally possible to
>translate those block-diagonal weights into diagonal weights except under some
>pretty specific, restrictive circumstances (such as when the mods vary only at
>the highest level of the model).
>Also, I would be grateful if someone would like to provide the formula to
>estimate model slopes for meta-regression in non-matrix notation. Summation
>notation is the best one - matrix notation is elsewhere.
>Why? The matrix notation is extremely useful for this sort of thing, whereas
>summation notation is cumbersome and awkward once you are working with
>regression/meta-regression models (especially when estimated by generalized least
>Yefeng Yang PhD
>UNSW Sydney

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