[R-meta] Equivalence of two models in metafor
Zhouhan Jin
zj|n65 @end|ng |rom uwo@c@
Tue Apr 9 00:34:04 CEST 2024
Sorry, Wolfgang, I missed the `method="FE"` part to control for tau^2 differences. Speaking of the effect of weights, I actually tried to simply fit two `lm()` models and, there again, `con1` and `con2` don't match.
I wonder what explains the difference in SEs etc. here (maybe the difference in sigmas)?
f1 <- lm(yi~X+0, data = dat)
f2 <- lm(yi~Y+0, data = dat)
( con1 = contrast(ref_grid(f1), list(c(1,-1))) )
( con2 = contrast(ref_grid(f2), list(c(1/2,1/2,-1))) )
Thanks in advance!
Best wishes,
Zhouhan
On Apr 8, 2024 at 18:11 -0400, Viechtbauer, Wolfgang (NP) <wolfgang.viechtbauer using maastrichtuniversity.nl>, wrote:
I am not sure which two contrasts you are comparing. As I tried to explain, these two are exactly identical:
f1 <- rma(yi~X+0, vi, data = dat, method="FE")
f2 <- rma(yi~Y+0, vi, data = dat, method="FE")
A = emmprep(f1)
B = emmprep(f2)
( con1 = contrast(A, list(c(1,-1))) )
w <- diag(solve(vcov(f2)))[1:2]
w <- w / sum(w)
( con2 = contrast(B, list(c(w,-1))) )
-----Original Message-----
From: Zhouhan Jin <zjin65 using uwo.ca>
Sent: Monday, April 8, 2024 23:58
To: R Special Interest Group for Meta-Analysis <r-sig-meta-analysis using r-
project.org>; Viechtbauer, Wolfgang (NP)
<wolfgang.viechtbauer using maastrichtuniversity.nl>
Subject: RE: Equivalence of two models in metafor
Thanks so much, Wolfgang!
It seems that the inferential results (SEs, test statistics, and p-values) are
still different between `con1` and `con2`.
The contrast for the model with more categories (`con2`) produces smaller values
for these inferential results compared to that from the contrast for the model
with less categories (`con1`).
Can I conclude that in a situation like this, f2 model (and thus `con2`)
subsumes/nests/includes f1 model (and thus `con1`), and hence the latter is
redundant?
Thanks a lot!
Best wishes,
Zhouhan
On Apr 8, 2024 at 16:37 -0400, Viechtbauer, Wolfgang (NP)
<wolfgang.viechtbauer using maastrichtuniversity.nl>, wrote:
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
[[alternative HTML version deleted]]
More information about the R-sig-meta-analysis
mailing list