The metafor Package

A Meta-Analysis Package for R

User Tools

Site Tools


analyses:vanhouwelingen2002

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
analyses:vanhouwelingen2002 [2021/10/22 14:46] Wolfgang Viechtbaueranalyses:vanhouwelingen2002 [2022/08/03 17:52] (current) Wolfgang Viechtbauer
Line 39: Line 39:
 </code> </code>
  
-==== Fixed-Effects Model ====+==== Equal-Effects Model ====
  
-The first model considered is the fixed-effects model based on the log odds ratios. The same model can be fitted with:+The first model considered is the equal-effects model based on the log odds ratios. The same model can be fitted with:
 <code rsplus> <code rsplus>
-res <- rma(yi, vi, data=dat, method="FE")+res <- rma(yi, vi, data=dat, method="EE")
 res res
 </code> </code>
 <code output> <code output>
-Fixed-Effects Model (k = 13)+Equal-Effects Model (k = 13) 
 + 
 +I^2 (total heterogeneity / total variability):   92.65% 
 +H^2 (total variability / sampling variability):  13.60
  
 Test for Heterogeneity: Test for Heterogeneity:
Line 54: Line 57:
 Model Results: Model Results:
  
-estimate       se     zval     pval    ci.lb    ci.ub +estimate      se      zval    pval    ci.lb    ci.ub 
- -0.4361   0.0423 -10.3190   <.0001  -0.5190  -0.3533      ***+ -0.4361  0.0423  -10.3190  <.0001  -0.5190  -0.3533  ***
  
 --- ---
-Signif. codes: ***’ 0.001 **’ 0.01 *’ 0.05 .’ 0.1 ‘ ’ 1+Signif. codes: '***0.001 '**0.01 '*0.05 '.0.1 ' ' 1
 </code> </code>
 For easier interpretation, these results can be back-transformed to the odds ratio scale with: For easier interpretation, these results can be back-transformed to the odds ratio scale with:
Line 120: Line 123:
 </code> </code>
 <code output> <code output>
-       estimate   ci.lb   ci.ub  +       estimate   ci.lb   ci.ub 
-tau^2    0.3025  0.1151  0.8937  +tau^2    0.3025  0.1151  0.8937 
-tau      0.5500  0.3393  0.9454  +tau      0.5500  0.3393  0.9454 
-I^2(%)  91.2283 79.8303 96.8485 +I^2(%)  91.2283 79.8303 96.8485
 H^2     11.4003  4.9579 31.7310 H^2     11.4003  4.9579 31.7310
 </code> </code>
Line 167: Line 170:
 <code rsplus> <code rsplus>
 res <- rma(measure="OR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat, method="ML") res <- rma(measure="OR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat, method="ML")
-labbe(res, xlim=c(-7,-1), ylim=c(-7,-1), xlab="ln(odds) not-vaccinated group", ylab="ln(odds) vaccinated group")+labbe(res, xlim=c(-7,-1), ylim=c(-7,-1), 
 +      xlab="ln(odds) not-vaccinated group", ylab="ln(odds) vaccinated group")
 </code> </code>
 The dashed line indicates the estimated effect based on the model. The dashed line indicates the estimated effect based on the model.
Line 216: Line 220:
 Since there is no overlap in the data used to calculate these arm-specific outcomes, the observed outcomes are (conditionally) independent. However, the corresponding true outcomes are likely to be correlated. The bivariate model allows us to estimate the variance and correlation of the true outcomes in the two arms: Since there is no overlap in the data used to calculate these arm-specific outcomes, the observed outcomes are (conditionally) independent. However, the corresponding true outcomes are likely to be correlated. The bivariate model allows us to estimate the variance and correlation of the true outcomes in the two arms:
 <code rsplus> <code rsplus>
-res <- rma.mv(yi, vi, mods = ~ group - 1, random = ~ group | trial, struct="UN", data=dat.long, method="ML")+res <- rma.mv(yi, vi, mods = ~ group - 1, 
 +              random = ~ group | trial, struct="UN", 
 +              data=dat.long, method="ML")
 res res
 </code> </code>
Line 254: Line 260:
 We can directly obtain the estimated (mean) log odds ratio from this model by not removing the intercept: We can directly obtain the estimated (mean) log odds ratio from this model by not removing the intercept:
 <code rsplus> <code rsplus>
-res <- rma.mv(yi, vi, mods = ~ group, random = ~ group | trial, struct="UN", data=dat.long, method="ML")+res <- rma.mv(yi, vi, mods = ~ group, 
 +              random = ~ group | trial, struct="UN", 
 +              data=dat.long, method="ML")
 </code> </code>
 The last part of the output is then: The last part of the output is then:
Line 278: Line 286:
  
 <code rsplus> <code rsplus>
-res <- rma.mv(yi, vi, mods = ~ group - 1, random = ~ group | trial, struct="UN", data=dat.long, method="ML"+res <- rma.mv(yi, vi, mods = ~ group - 1, 
-reg <- matreg(y=2, x=1, R=res$G, cov=TRUE, means=coef(res), n=res$g.levels.comb.k) +              random = ~ group | trial, struct="UN", 
 +              data=dat.long, method="ML"
 +reg <- matreg(y=2, x=1, R=res$G, cov=TRUE, means=coef(res), n=res$g.levels.comb.k)
 reg reg
 </code> </code>
 <code output> <code output>
-         estimate      se     tval  df    pval    ci.lb    ci.ub  +         estimate      se     tval  df    pval    ci.lb    ci.ub 
-intrcpt   -1.8437  0.3265  -5.6477  11  0.0001  -2.5623  -1.1252  ***  +intrcpt   -1.8437  0.3265  -5.6477  11  0.0001  -2.5623  -1.1252  *** 
-CON        0.7300  0.0749   9.7467  11  <.0001   0.5651   0.8948  *** +CON        0.7300  0.0749   9.7467  11  <.0001   0.5651   0.8948  ***
  
 --- ---
Line 293: Line 303:
 Then Figure 5 in the paper (p. 605) can be recreated with: Then Figure 5 in the paper (p. 605) can be recreated with:
 <code rsplus> <code rsplus>
-tmp <- rma(measure="OR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat, method="FE") +tmp <- rma(measure="OR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat, method="EE") 
-labbe(tmp, xlim=c(-8,0), ylim=c(-8,0), xlab="ln(odds) not-vaccinated group", ylab="ln(odds) vaccinated group", lty=c("dotted", "blank"), grid=TRUE)+labbe(tmp, xlim=c(-8,0), ylim=c(-8,0), 
 +      xlab="ln(odds) not-vaccinated group", ylab="ln(odds) vaccinated group", 
 +      lty=c("dotted", "blank"), grid=TRUE)
 points(coef(res)[1], coef(res)[2], pch=19, cex=3) points(coef(res)[1], coef(res)[2], pch=19, cex=3)
 abline(a=reg$tab$beta[1], b=reg$tab$beta[2], lwd=3) abline(a=reg$tab$beta[1], b=reg$tab$beta[2], lwd=3)
Line 315: Line 327:
 abline(h=x[2]) abline(h=x[2])
 </code> </code>
 +
 +While the coefficient (i.e., 0.7300) of the relationship between the underlying true log odds in the vaccinated and unvaccinated groups obtained above is correct, the computation of the corresponding standard error is not quite right, as it assumes that the variance-covariance matrix used as input to ''matreg()'' (i.e., ''res$G'') was obtained from 'raw data' for ''res$g.levels.comb.k'' (i.e., 13) paired data points, when in fact ''res$G'' is the estimated variance-covariance matrix of the random effects from the bivariate model. To obtain a more appropriate standard error, we need to first obtain the variance-covariance matrix of the estimates in ''res$G'', which we can get with:((By default, there are numerical problems inverting the Hessian matrix in this example, which we can work around using ''control=list(nearpd=TRUE)''.))
 +
 +<code rsplus>
 +res <- rma.mv(yi, vi, mods = ~ group - 1,
 +              random = ~ group | trial, struct="UN",
 +              data=dat.long, method="ML", cvvc="varcov", control=list(nearpd=TRUE))
 +</code>
 +
 +Now ''res$vvc'' contains the variance-covariance matrix of the estimates in ''res$G'':
 +
 +<code rsplus>
 +res$vvc
 +</code>
 +<code output>
 +          tau^2.1       cov   tau^2.2
 +tau^2.1 0.9359073 0.6711028 0.4822374
 +cov     0.6711028 0.5245460 0.4066553
 +tau^2.2 0.4822374 0.4066553 0.3399395
 +</code>
 +
 +We can then use this matrix as part of the input to ''matreg()'', that is, instead of specifying the sample size via argument ''n'' as was done above, we specify argument ''V'' with this matrix as input:
 +
 +<code rsplus>
 +matreg(y=2, x=1, R=res$G, cov=TRUE, means=coef(res), V=res$vvc)
 +</code>
 +
 +<code output>
 +         estimate      se     zval    pval    ci.lb    ci.ub
 +intrcpt   -1.8437  0.3548  -5.1967  <.0001  -2.5391  -1.1484  ***
 +CON        0.7300  0.0866   8.4276  <.0001   0.5602   0.8998  ***
 +</code>
 +
 +Now the standard error of the coefficient of interest is computed in such a way that it correctly takes the imprecision of the estimates in ''res$G'' into consideration.
  
 ==== Meta-Regression ==== ==== Meta-Regression ====
Line 358: Line 404:
 The bivariate meta-regression model can be fitted with: The bivariate meta-regression model can be fitted with:
 <code rsplus> <code rsplus>
-res <- rma.mv(yi, vi, mods = ~ group + group:I(ablat-33) - 1, random = ~ group | trial, struct="UN", data=dat.long, method="ML")+res <- rma.mv(yi, vi, mods = ~ group + group:I(ablat-33) - 1, 
 +              random = ~ group | trial, struct="UN", 
 +              data=dat.long, method="ML")
 res res
 </code> </code>
Line 398: Line 446:
 The difference in slopes can be directly obtained with: The difference in slopes can be directly obtained with:
 <code rsplus> <code rsplus>
-res <- rma.mv(yi, vi, mods = ~ group*I(ablat-33), random = ~ group | trial, struct="UN", data=dat.long, method="ML")+res <- rma.mv(yi, vi, mods = ~ group*I(ablat-33), 
 +              random = ~ group | trial, struct="UN", 
 +              data=dat.long, method="ML")
 </code> </code>
 The results are the same as before, except for the last part, which is now equal to: The results are the same as before, except for the last part, which is now equal to:
analyses/vanhouwelingen2002.1634913993.txt.gz · Last modified: 2021/10/22 14:46 by Wolfgang Viechtbauer