[R-meta] Equivalence of two models in metafor

Viechtbauer, Wolfgang (NP) wo||g@ng@v|echtb@uer @end|ng |rom m@@@tr|chtun|ver@|ty@n|
Mon Apr 8 22:37:31 CEST 2024


Dear Zhouhan,

If you want to compare these two contrasts, you should use:

( con1 = contrast(A, list(c(1,-1))) )
( con2 = contrast(B, list(c(1/2,1/2,-1))) )

You will find they are similar, but still not identical. There are two reasons for this. First, the estimates of tau^2 are different in the two models. This leads to different weighting schemes. But even if we use a fixed-effects meta-regression model with:

f1 <- rma(yi~X+0, vi, data = dat, method="FE")
f2 <- rma(yi~Y+0, vi, data = dat, method="FE")

you will find that the contrasts are still different. That's because one has to use an appropriately weighted average of the estimates of Yb and Yc to get the same contrast:

w <- diag(solve(vcov(f2)))[1:2]
w <- w / sum(w)
( con2 = contrast(B, list(c(w,-1))) )

This is now the same as:

( con1 = contrast(A, list(c(1,-1))) )

Best,
Wolfgang

> -----Original Message-----
> From: R-sig-meta-analysis <r-sig-meta-analysis-bounces using r-project.org> On Behalf
> Of Zhouhan Jin via R-sig-meta-analysis
> Sent: Tuesday, April 2, 2024 17:47
> To: r-sig-meta-analysis using r-project.org
> Cc: Zhouhan Jin <zjin65 using uwo.ca>
> Subject: [R-meta] Equivalence of two models in metafor
>
> Dear Wolfgang,
>
> Below, moderator X is coded "no" whenever moderator Y is coded "b" or "c", and
> moderator X is coded "yes" whenever moderator Y is coded "d".
>
> Thus, I expected that a contrast like "no - yes" (`con1`) to be identical to a
> contrast like "b + c - d" (`con2`).
>
> However, I wonder why `con1` and `con2` aren't identical?
>
> dat <- read.table(header=TRUE, text="
> study  X        Y   yi  vi
> 1      no       b   1   .1
> 1      no       b   2   .2
> 1      no       c   .9  .1
> 2      no       c   .7  .3
> 2      yes      d   .6  .1
> 3      yes      d   .5  .1")
>
> f1 <- rma(yi~X+0, vi, data = dat)
> f2 <- rma(yi~Y+0, vi, data = dat)
>
> A = emmprep(f1)
> B = emmprep(f2)
>
> ( con1 = contrast(A, list(c(1,-1))) )
> ( con2 = contrast(B, list(c(1,1,-1))) )
>
> Thanks in advance!
>
> Best wishes,
>
> Zhouhan



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