[R-meta] metafor inquiry: weighted moderators
Viechtbauer, Wolfgang (NP)
wo||g@ng@v|echtb@uer @end|ng |rom m@@@tr|chtun|ver@|ty@n|
Sun Dec 3 13:47:11 CET 2023
Hi Daniel,
In the original formulation of the regression test by Egger (which uses standard regression models), there are two numerically equivalent formulations, one using the standard errors as predictor of the effect size estimates and one using the precisions (1 / standard errors) as predictor of the z-scores (effect size estimates / standard errors). In the first formulation, we use WLS, in the second formualation OLS. To demonstrate:
library(metafor)
### calculate log risk ratios and corresponding sampling variances
dat <- escalc(measure="RR", ai=ai, n1i=n1i,
ci=ci, n2i=n2i, data=dat.graves2010)
dat
### regression test using lm(); two formulations
summary(lm(yi ~ sqrt(vi), weights=1/vi, data=dat))
summary(lm(yi/sqrt(vi) ~ I(1/sqrt(vi)), data=dat))
Note that in the first formulation, we look at the slope of sqrt(vi), in the second formulation things are flipped around and we look at the intercept.
For fixed-effects meta-regression models, these two formulations are also equivalent:
### regression test using a fixed-effects meta-regression model
rma(yi, vi, mods = ~ sqrt(vi), data=dat, method="FE")
rma(yi/sqrt(vi), 1, mods = ~ I(1/sqrt(vi)), data=dat, method="FE")
Note that while the coefficients are the same as when using lm(), the SEs of the coefficients are different because a fixed-effects meta-regression model does not include the multiplicative dispersion term that lm() includes.
However, once we move to random/mixed-effects models, there is really only one formulation, where we use sqrt(vi) as predictor, that is:
### regression test using a mixed-effects meta-regression model
rma(yi, vi, mods = ~ sqrt(vi), data=dat)
The same applies to multilevel models like you are fitting. So, you really need to use the effect size estimates as outcome (not 'Tstat'). The rest is fine.
Best,
Wolfgang
> -----Original Message-----
> From: R-sig-meta-analysis <r-sig-meta-analysis-bounces using r-project.org> On Behalf
> Of Daniel Foster via R-sig-meta-analysis
> Sent: Saturday, December 2, 2023 23:06
> To: r-sig-meta-analysis using r-project.org
> Cc: Daniel Foster <daniel.foster using utoronto.ca>
> Subject: [R-meta] metafor inquiry: weighted moderators
>
> Hello Wolfgang, I hope all is well. My name is Daniel, I am carrying out a
> multi-level meta-analysis using the metafor package, and I was hoping you could
> answer a quick question for me.
>
> I am trying to assess publication bias using the PET method. To do this you
> include the inverse of the SE as a predictor in your model. In the code below,
> mods = ~ SE calls on the unweighted SE data from my dataframe. What I am unsure
> of is if the rma.mv function automatically weights "~SE" as 1/SE (as is needed
> for the PET method).
>
> So do I need to calculate the weighted SE before including it in the model
> below, or does metafor do this for me?
>
> overalleffectPET <- rma.mv(Tstat, Variance,
> + mods = ~ SE,
> + random = list(~ 1 | EffectSize_ID, ~ 1 | Study_ID),
> + tdist= TRUE, data=EmployBinaryITT)
>
> Thank you in advance for both you time and help!
>
> Daniel
>
> ----------------------------
>
> Daniel Foster, M.Ed.
> PhD Candidate | Department of Applied Psychology and Human Development |
> University of Toronto
> Research Associate | Atkinson Centre for Society and Child Development
More information about the R-sig-meta-analysis
mailing list