library(meta)
## Loading 'meta' package (version 5.2-0).
## Type 'help(meta)' for a brief overview.
## Readers of 'Meta-Analysis with R (Use R!)' should install
## older version of 'meta' package: https://tinyurl.com/dt4y5drs
ls()
## character(0)
data("Fleiss1993bin")
ls()
## [1] "Fleiss1993bin"
str(Fleiss1993bin)
## 'data.frame': 7 obs. of 6 variables:
## $ study : chr "MRC-1" "CDP" "MRC-2" "GASP" ...
## $ year : int 1974 1976 1979 1979 1980 1980 1988
## $ d.asp : int 49 44 102 32 85 246 1570
## $ n.asp : int 615 758 832 317 810 2267 8587
## $ d.plac: int 67 64 126 38 52 219 1720
## $ n.plac: int 624 771 850 309 406 2257 8600
head(Fleiss1993bin)
## study year d.asp n.asp d.plac n.plac
## 1 MRC-1 1974 49 615 67 624
## 2 CDP 1976 44 758 64 771
## 3 MRC-2 1979 102 832 126 850
## 4 GASP 1979 32 317 38 309
## 5 PARIS 1980 85 810 52 406
## 6 AMIS 1980 246 2267 219 2257
metabin(d.asp, n.asp, d.plac, n.plac, data = Fleiss1993bin, studlab = paste(study, year), sm = "OR", random = FALSE)
## Number of studies combined: k = 7
## Number of observations: o = 28003
## Number of events: e = 4414
##
## OR 95%-CI z p-value
## Common effect model 0.8969 [0.8405; 0.9570] -3.29 0.0010
##
## Quantifying heterogeneity:
## tau^2 = 0.0147 [0.0000; 0.1145]; tau = 0.1214 [0.0000; 0.3384]
## I^2 = 39.7% [0.0%; 74.6%]; H = 1.29 [1.00; 1.99]
##
## Test of heterogeneity:
## Q d.f. p-value
## 9.95 6 0.1269
##
## Details on meta-analytical method:
## - Mantel-Haenszel method
## - Restricted maximum-likelihood estimator for tau^2
## - Q-profile method for confidence interval of tau^2 and tau
ls()
## [1] "Fleiss1993bin"
ORfij <- metabin(d.asp, n.asp, d.plac, n.plac, data = Fleiss1993bin, studlab = paste(study, year), sm = "OR", random = FALSE)
ls()
## [1] "Fleiss1993bin" "ORfij"
ORfij
## Number of studies combined: k = 7
## Number of observations: o = 28003
## Number of events: e = 4414
##
## OR 95%-CI z p-value
## Common effect model 0.8969 [0.8405; 0.9570] -3.29 0.0010
##
## Quantifying heterogeneity:
## tau^2 = 0.0147 [0.0000; 0.1145]; tau = 0.1214 [0.0000; 0.3384]
## I^2 = 39.7% [0.0%; 74.6%]; H = 1.29 [1.00; 1.99]
##
## Test of heterogeneity:
## Q d.f. p-value
## 9.95 6 0.1269
##
## Details on meta-analytical method:
## - Mantel-Haenszel method
## - Restricted maximum-likelihood estimator for tau^2
## - Q-profile method for confidence interval of tau^2 and tau
forest(ORfij)
## Ahora lo hacemos bajo modelo de efectos aleatorios
ORale <- metabin(d.asp, n.asp, d.plac, n.plac, data = Fleiss1993bin, studlab = paste(study, year), sm = "OR", fixed = FALSE)
(ORale <- metabin(d.asp, n.asp, d.plac, n.plac, data = Fleiss1993bin, studlab = paste(study, year), sm = "OR", fixed = FALSE))
## Number of studies combined: k = 7
## Number of observations: o = 28003
## Number of events: e = 4414
##
## OR 95%-CI z p-value
## Random effects model 0.8683 [0.7559; 0.9973] -2.00 0.0457
##
## Quantifying heterogeneity:
## tau^2 = 0.0147 [0.0000; 0.1145]; tau = 0.1214 [0.0000; 0.3384]
## I^2 = 39.7% [0.0%; 74.6%]; H = 1.29 [1.00; 1.99]
##
## Test of heterogeneity:
## Q d.f. p-value
## 9.95 6 0.1269
##
## Details on meta-analytical method:
## - Mantel-Haenszel method
## - Restricted maximum-likelihood estimator for tau^2
## - Q-profile method for confidence interval of tau^2 and tau
ORale
## Number of studies combined: k = 7
## Number of observations: o = 28003
## Number of events: e = 4414
##
## OR 95%-CI z p-value
## Random effects model 0.8683 [0.7559; 0.9973] -2.00 0.0457
##
## Quantifying heterogeneity:
## tau^2 = 0.0147 [0.0000; 0.1145]; tau = 0.1214 [0.0000; 0.3384]
## I^2 = 39.7% [0.0%; 74.6%]; H = 1.29 [1.00; 1.99]
##
## Test of heterogeneity:
## Q d.f. p-value
## 9.95 6 0.1269
##
## Details on meta-analytical method:
## - Mantel-Haenszel method
## - Restricted maximum-likelihood estimator for tau^2
## - Q-profile method for confidence interval of tau^2 and tau
forest(ORfij)
forest(ORale)
ORvi <- metabin(d.asp, n.asp, d.plac, n.plac, data = Fleiss1993bin, studlab = paste(study, year), sm = "OR", method = "Inverse", fixed = FALSE)
ORvi
## Number of studies combined: k = 7
## Number of observations: o = 28003
## Number of events: e = 4414
##
## OR 95%-CI z p-value
## Random effects model 0.8683 [0.7559; 0.9973] -2.00 0.0457
##
## Quantifying heterogeneity:
## tau^2 = 0.0147 [0.0000; 0.1145]; tau = 0.1214 [0.0000; 0.3384]
## I^2 = 39.7% [0.0%; 74.6%]; H = 1.29 [1.00; 1.99]
##
## Test of heterogeneity:
## Q d.f. p-value
## 9.95 6 0.1269
##
## Details on meta-analytical method:
## - Inverse variance method
## - Restricted maximum-likelihood estimator for tau^2
## - Q-profile method for confidence interval of tau^2 and tau
forest(ORvi)
forest(ORfij, leftcols = "studlab")
forest(ORale, leftcols = "studlab")
forest(ORvi, leftcols = "studlab", rightcols = FALSE)
forest(ORvi, leftcols = "studlab", rightcols = FALSE, calcwidth.hetstat = TRUE)
forest(ORvi, leftcols = "studlab", rightcols = FALSE, calcwidth.hetstat = TRUE, just.studlab = "right")
forest(ORvi, leftcols = "studlab", rightcols = FALSE, calcwidth.hetstat = TRUE, just.studlab = "right", colgap.forest.left = "1cm")
forest(ORvi, leftcols = "studlab", rightcols = FALSE, calcwidth.hetstat = TRUE, just.studlab = "right", colgap.forest.left = "1cm", col.square = "red")
forest(ORvi, leftcols = "studlab", rightcols = FALSE, calcwidth.hetstat = TRUE, just.studlab = "right", colgap.forest.left = "1cm", col.square.lines = "red")
data("Fleiss1993cont")
ls()
## [1] "Fleiss1993bin" "Fleiss1993cont" "ORale" "ORfij"
## [5] "ORvi"
str(Fleiss1993cont)
## 'data.frame': 5 obs. of 8 variables:
## $ study : chr "Davis" "Florell" "Gruen" "Hart" ...
## $ year : int 1973 1971 1975 1975 1977
## $ n.psyc : int 13 30 35 20 8
## $ mean.psyc: num 5 4.9 22.5 12.5 6.5
## $ sd.psyc : num 4.7 1.71 3.44 1.47 0.76
## $ n.cont : int 13 50 35 20 8
## $ mean.cont: num 6.5 6.1 24.9 12.3 7.38
## $ sd.cont : num 3.8 2.3 10.65 1.66 1.41
head(Fleiss1993cont)
## study year n.psyc mean.psyc sd.psyc n.cont mean.cont sd.cont
## 1 Davis 1973 13 5.0 4.70 13 6.50 3.80
## 2 Florell 1971 30 4.9 1.71 50 6.10 2.30
## 3 Gruen 1975 35 22.5 3.44 35 24.90 10.65
## 4 Hart 1975 20 12.5 1.47 20 12.30 1.66
## 5 Wilson 1977 8 6.5 0.76 8 7.38 1.41
ls()
## [1] "Fleiss1993bin" "Fleiss1993cont" "ORale" "ORfij"
## [5] "ORvi"
mediafij <- metacont(n.psyc, mean.psyc, sd.psyc, n.cont, mean.cont, sd.cont, data = Fleiss1993cont, studlab = paste(study, year), random = FALSE)
mediafij
## Number of studies combined: k = 5
## Number of observations: o = 232
##
## MD 95%-CI z p-value
## Common effect model -0.7094 [-1.2585; -0.1603] -2.53 0.0113
##
## Quantifying heterogeneity:
## tau^2 = 0.2742 [0.0000; 5.8013]; tau = 0.5236 [0.0000; 2.4086]
## I^2 = 29.3% [0.0%; 72.6%]; H = 1.19 [1.00; 1.91]
##
## Test of heterogeneity:
## Q d.f. p-value
## 5.66 4 0.2260
##
## Details on meta-analytical method:
## - Inverse variance method
## - Restricted maximum-likelihood estimator for tau^2
## - Q-profile method for confidence interval of tau^2 and tau
forest(mediafij)
ls()
## [1] "Fleiss1993bin" "Fleiss1993cont" "mediafij" "ORale"
## [5] "ORfij" "ORvi"
mediaale <- metacont(n.psyc, mean.psyc, sd.psyc, n.cont, mean.cont, sd.cont, data = Fleiss1993cont, studlab = paste(study, year), fixed = FALSE)
mediaale
## Number of studies combined: k = 5
## Number of observations: o = 232
##
## MD 95%-CI z p-value
## Random effects model -0.7509 [-1.5328; 0.0311] -1.88 0.0598
##
## Quantifying heterogeneity:
## tau^2 = 0.2742 [0.0000; 5.8013]; tau = 0.5236 [0.0000; 2.4086]
## I^2 = 29.3% [0.0%; 72.6%]; H = 1.19 [1.00; 1.91]
##
## Test of heterogeneity:
## Q d.f. p-value
## 5.66 4 0.2260
##
## Details on meta-analytical method:
## - Inverse variance method
## - Restricted maximum-likelihood estimator for tau^2
## - Q-profile method for confidence interval of tau^2 and tau
forest(mediaale)
forest(mediafij)
forest(mediaale, leftcols = "studlab", calcwidth.hetstat = TRUE, just.studlab = "right", colgap.forest.left = "1cm", col.square.lines = "red")