Skip to content
Prev 3928 / 5636 Next

[R-meta] Bivariate generalized linear mixed model with {metafor}

Very enlightening code, thank you!!

I noted that you used a different lme4 syntax for this model in your article with Jackson et al with?a ?control? indicator and removed the intercept within the random effect.

I compared both syntax outputs. Results are all the same, except the random effect correlation parameter (opposite results). Do you know why?

library(metafor)
library(lme4)

dat <- structure(list(study.name = c("Cutler1995", "Dahlof1991", "Dowson2002", "Ensink1991", "Geraud2000", "Goadsby1991", "Goadsby2000", "Havanka2000", "Kaniecki2006", "Mathew2003", "Myllyla1998", "Nappi1994", "Patten1991", "Pfaffenrath1998", "Sandrini2002", "Sargent1995", "Sheftell2005", "Tfelt-Hansen1995", "Tfelt-Hansen1998", "Visser1996"), n1 = c(66L, 275L, 194L, 131L, 504L, 89L, 129L, 98L, 131L, 831L, 42L, 142L, 142L, 277L, 170L, 46L, 902L, 122L, 388L, 72L), n2 = c(65L, 182L, 99L, 78L, 56L, 93L, 142L, 91L, 127L, 419L, 41L, 81L, 101L, 91L, 84L, 47L, 892L, 126L, 160L, 85L), r1 = c(37L, 180L, 123L, 60L, 304L, 45L, 63L, 59L, 64L, 471L, 33L, 73L, 95L, 175L, 85L, 26L, 649L, 63L, 239L, 33L), r2 = c(17L, 48L, 42L, 14L, 24L, 9L, 30L, 28L, 47L, 105L, 12L, 25L, 22L, 27L, 25L, 8L, 375L, 30L, 64L, 15L)), row.names = c(NA, 20L), class = "data.frame")

dat <- to.long(measure="OR", ai=r1, n1i=n1, ci=r2, n2i=n2, data=dat)

res <- glmer(cbind(out1,out2) ~ group + (group | study), data=dat, family=binomial)
summary(res)

VarCorr(res)
# Corr = -0.68

dat_mod = dat
dat_mod$treat = ifelse(dat$group==1, 1, 0)
dat_mod$control = ifelse(dat$group==2, 1, 0)

model6 = glmer(cbind(out1,out2)~factor(treat)+(control+treat-1|study),
?data=dat_mod, family=binomial(link="logit"))

summary(model6)

VarCorr(model6)
# Corr = 0.686

Best,

Arthur M. Albuquerque

Medical student
Universidade Federal do Rio de Janeiro, Brazil
On Mar 9, 2022, 6:54 PM -0300, Viechtbauer, Wolfgang (SP) <wolfgang.viechtbauer at maastrichtuniversity.nl>, wrote: