methods.confint.rma.Rd
Methods for objects of class "confint.rma"
and "list.confint.rma"
.
# S3 method for class 'confint.rma'
as.data.frame(x, ...)
# S3 method for class 'list.confint.rma'
as.data.frame(x, ...)
Viechtbauer, W. (2010). Conducting meta-analyses in R with the metafor package. Journal of Statistical Software, 36(3), 1–48. https://doi.org/10.18637/jss.v036.i03
### copy data into 'dat'
dat <- dat.bcg
### calculate log risk ratios and corresponding sampling variances
dat <- escalc(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat)
### fit random-effects model
res <- rma(yi, vi, data=dat)
### get 95% CI for tau^2, tau, I^2, and H^2
sav <- confint(res)
sav
#>
#> estimate ci.lb ci.ub
#> tau^2 0.3132 0.1197 1.1115
#> tau 0.5597 0.3460 1.0543
#> I^2(%) 92.2214 81.9177 97.6781
#> H^2 12.8558 5.5303 43.0680
#>
### turn object into a regular data frame
as.data.frame(sav)
#> estimate ci.lb ci.ub
#> tau^2 0.3132433 0.1196953 1.111486
#> tau 0.5596815 0.3459701 1.054270
#> I^2(%) 92.2213861 81.9177227 97.678090
#> H^2 12.8557608 5.5302769 43.067984
############################################################################
### copy data into 'dat'
dat <- dat.berkey1998
### construct block diagonal var-cov matrix of the observed outcomes based on variables v1i and v2i
V <- vcalc(vi=1, cluster=author, rvars=c(v1i, v2i), data=dat)
### fit multivariate model
res <- rma.mv(yi, V, mods = ~ 0 + outcome, random = ~ outcome | trial, struct="UN", data=dat)
### get 95% CI for variance components and correlation
sav <- confint(res)
sav
#>
#> estimate ci.lb ci.ub
#> tau^2.1 0.0327 0.0095 0.2068
#> tau.1 0.1807 0.0974 0.4547
#>
#> estimate ci.lb ci.ub
#> tau^2.2 0.0117 0.0001 0.1114
#> tau.2 0.1083 0.0098 0.3338
#>
#> estimate ci.lb ci.ub
#> rho 0.6088 -0.5996 1.0000
#>
### turn object into a regular data frame
as.data.frame(sav)
#> estimate ci.lb ci.ub
#> tau^2.1 0.03265130 9.489498e-03 0.2067776
#> tau.1 0.18069672 9.741405e-02 0.4547281
#> tau^2.2 0.01173302 9.597309e-05 0.1114429
#> tau.2 0.10831908 9.796586e-03 0.3338307
#> rho 0.60879872 -5.996186e-01 1.0000000