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

Yefeng Yang ye|eng@y@ng1 @end|ng |rom un@w@edu@@u
Tue Apr 4 03:26:42 CEST 2023

```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-project.org/doku.php/tips:rma_vs_lm_lme_lmer

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 <- 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, type="obs"))), dat = dat)
coef(summary(res.ml))
coef(summary(res.ml.lm))

If I do a post-hoc adjustment to the SE(beta0) of res.ml, we can get the same SE from res.ml.lm:
coef(summary(res.ml.lm))[2]/summary(res.ml.lm)\$sigma

However, when I was working on meta-regression, it did not work. see the below syntax:
# regression with vi as a predictor
res.mr <- 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, type="obs"))), dat = dat)
coef(summary(res.mr))
coef(summary(res.mr.lm))

This is a key illustration of my working paper. Hopefully, I can get some help from here, especially from Wolfgang. 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.

Best,
Yefeng Yang PhD
UNSW Sydney

[[alternative HTML version deleted]]

```