| Title: | Exact Confidence Intervals for Random Effects Meta-Analyses |
|---|---|
| Description: | Compute an exact CI for the population mean under a random effects model. The routines implement the algorithm described in Michael, Thronton, Xie, and Tian (2017) <https://haben-michael.github.io/research/Exact_Inference_Meta.pdf>. |
| Authors: | Haben Michael [aut, cre], Lu Tian [aut] |
| Maintainer: | Haben Michael <[email protected]> |
| License: | GPL-3 |
| Version: | 0.1.0 |
| Built: | 2026-05-20 10:23:10 UTC |
| Source: | https://github.com/cran/rma.exact |
Combine confidence regions from two RMA.Exact objects
## S3 method for class 'RMA.Exact' rma1 + rma2## S3 method for class 'RMA.Exact' rma1 + rma2
rma1 |
the first RMA.Exact object |
rma2 |
the second RMA.Exact object |
an object of class RMA.Exact
A warning will be issued if the reported endpoints of the confidence interval are near the bounding box.
## S3 method for class 'RMA.Exact' confint(object, parm, level = 0.05, ...)## S3 method for class 'RMA.Exact' confint(object, parm, level = 0.05, ...)
object |
an object of class RMA.Exact |
parm |
(inherited) |
level |
the significance levels at which the compute the confidence intervals |
... |
(currently for internal use) |
a matrix with a row corresponding to each weight parameter c0 stored in rma0, and columns containing the upper and lower interval endpoints, the population variance values at whcih those endpoints were obtained, etc.
## see ?RMA.Exact## see ?RMA.Exact
Plot a confidence region given by an RMA.Exact object
## S3 method for class 'RMA.Exact' plot(x, ..., levels = c(0.01, 0.02, 0.05, 0.1, 0.15, 0.2), mfrow = c(1, dim(rma0)[3]))## S3 method for class 'RMA.Exact' plot(x, ..., levels = c(0.01, 0.02, 0.05, 0.1, 0.15, 0.2), mfrow = c(1, dim(rma0)[3]))
x |
an object of class RMA.Exact |
... |
additional parameters passed down to graphics::contour (passed from there down to plot.window) |
levels |
the significance levels to plot |
mfrow |
the dimensions of the array of plotting windows for use when rma0 contains regions for multiple weight parameters; defaults to a single row with as many as columns as regions contained in rma0 |
undefined
## see ?RMA.Exact## see ?RMA.Exact
Compute an exact confidence interval for the grand mean in a normal-normal random effects meta-analysis.
rma.exact(yi, vi, c0 = 1, level = 0.05, mu.bounds = NULL, tau2.bounds = NULL, resolution = 100, resolution.mu = resolution, resolution.tau2 = resolution, Z = NULL, B = 3000, mu.alpha = 0.995, tau2.alpha = 0.995, plot = TRUE, test.stat = NULL, ...)rma.exact(yi, vi, c0 = 1, level = 0.05, mu.bounds = NULL, tau2.bounds = NULL, resolution = 100, resolution.mu = resolution, resolution.tau2 = resolution, Z = NULL, B = 3000, mu.alpha = 0.995, tau2.alpha = 0.995, plot = TRUE, test.stat = NULL, ...)
yi |
a vector containing the primary study measurements |
vi |
a vector of the same length as yi containing the variances of the of the primary study measurements contained in yi |
c0 |
a vector containing the mixing parameters for the test statistics |
level |
the level of the confidence interval; set to NULL to plot a confidence region, otherwise rma.exact.fast is called using the specified level |
mu.bounds |
upper and lower bounds for the range of population effect values for constructing the confidence region; if NULL, value will be calculated from mu.alpha |
tau2.bounds |
upper and lower bounds for the range of population variance values for constructing the confidence region; if NULL, value will be calculated from tau2.alpha |
resolution |
resolution of the population mean and variance values within the bounding box |
resolution.mu |
resolution of the population mean values within the bounding box |
resolution.tau2 |
resolution of the population variance values within the bounding box |
Z |
a matrix of length(yi) rows with each row consisting of standard normal samples to be used in the monte carlo estimation of the null distribution of the test statistic; if NULL, B values will be sampled per row |
B |
the number of monte carlo replicates per primary study observation to be used |
mu.alpha |
the level of the exact CI for constructing the bounds on the population mean dimension of the bounding box |
tau2.alpha |
the level of the exact CI for constructing the bounds on the population variance dimension of the bounding box |
plot |
whether to plot the confidence region (if level is not NULL) or its boundary (if level is NULL) |
test.stat |
(currently for internal use) |
... |
(currently for internal use) |
Computes an exact (up to monte carlo error), unconditional, non-randomized CI for the grand mean in a random effects meta-analysis assuming a normal-normal model for the primary study observations. This function implements the algorithm described in:
Michael, Thornton, Xie, and Tian (2017). Exact Inference on the Random Effects Model for Meta-Analyses with Few Studies. (Submitted.)
If the parameter "level" is not NULL (the default value is .05), this function passes the call down to rma.exact.fast, which computes a CI at the specified level. If "level" is set to NULL, an entire 2-dimensional grid of p-values is estimated. In the latter case, an RMA.Exact object is returned, which may be passed to a plot routine to plot contours of confidence regions.
if "level" is not NULL, a named vector of CI endpoints; otherwise, an object of class RMA.Exact
rma.exact.fast for computing confidence intervals at specified levels, plot.RMA.Exact, confint.RMA.Exact
set.seed(1) K <- 5 c0 <- 1 mu0 <- 0 tau2 <- 12.5 vi <- (seq(1, 5, length=K))^2 yi <- rnorm(K)*sqrt(vi+tau2)+mu0 rma.exact(yi=yi,vi=vi) ## plotting a conifdence region and printing CIs with an RMA.Exact object rma0 <- rma.exact(yi=yi,vi=vi,level=NULL) plot(rma0) confint(rma0) ## confidence region with multiple c0 values using an RMA.Exact object c0 <- c(0,.25,1) tau2 <- 12.5 vi <- (seq(1, 5, length=K))^2 yi=rnorm(K)*sqrt(vi+tau2)+mu0 rma0 <- rma.exact(yi=yi,vi=vi,c0=c0,level=NULL) plot(rma0) confint(rma0) ## setting tau2.bounds and other parameters to non-default values using an RMA.Exact object Z <- matrix(rnorm(K*5e3),nrow=K) B <- ncol(Z) resolution <- 3e2 rma0 <- rma.exact(yi=yi,vi=vi,level=NULL,Z=Z,resolution=resolution,c0=c0, tau2.bounds=c(1,120),resolution.tau2=1e3,resolution.mu=1e2) plot(rma0) c0 <- 1:4 rma0 <- rma.exact(yi=yi,vi=vi,level=NULL,Z=Z,resolution=resolution,c0=c0, tau2.bounds=c(1,450),resolution.tau2=1e3,resolution.mu=1e2) plot(rma0) confint(rma0,level=c(.05))set.seed(1) K <- 5 c0 <- 1 mu0 <- 0 tau2 <- 12.5 vi <- (seq(1, 5, length=K))^2 yi <- rnorm(K)*sqrt(vi+tau2)+mu0 rma.exact(yi=yi,vi=vi) ## plotting a conifdence region and printing CIs with an RMA.Exact object rma0 <- rma.exact(yi=yi,vi=vi,level=NULL) plot(rma0) confint(rma0) ## confidence region with multiple c0 values using an RMA.Exact object c0 <- c(0,.25,1) tau2 <- 12.5 vi <- (seq(1, 5, length=K))^2 yi=rnorm(K)*sqrt(vi+tau2)+mu0 rma0 <- rma.exact(yi=yi,vi=vi,c0=c0,level=NULL) plot(rma0) confint(rma0) ## setting tau2.bounds and other parameters to non-default values using an RMA.Exact object Z <- matrix(rnorm(K*5e3),nrow=K) B <- ncol(Z) resolution <- 3e2 rma0 <- rma.exact(yi=yi,vi=vi,level=NULL,Z=Z,resolution=resolution,c0=c0, tau2.bounds=c(1,120),resolution.tau2=1e3,resolution.mu=1e2) plot(rma0) c0 <- 1:4 rma0 <- rma.exact(yi=yi,vi=vi,level=NULL,Z=Z,resolution=resolution,c0=c0, tau2.bounds=c(1,450),resolution.tau2=1e3,resolution.mu=1e2) plot(rma0) confint(rma0,level=c(.05))
Compute a confidence interval for the grand mean at a user-specified confidence level.
rma.exact.fast(yi, vi, c0 = 1.2 * (length(yi) < 6) + 0.6 * (length(yi) >= 6 & length(yi) < 10) + 0.2 * (length(yi) >= 10), level = 0.05, plot = TRUE, tau2.bounds = NULL, resolution = 100, Z = NULL, B = 3000, tau2.alpha = 0.995)rma.exact.fast(yi, vi, c0 = 1.2 * (length(yi) < 6) + 0.6 * (length(yi) >= 6 & length(yi) < 10) + 0.2 * (length(yi) >= 10), level = 0.05, plot = TRUE, tau2.bounds = NULL, resolution = 100, Z = NULL, B = 3000, tau2.alpha = 0.995)
yi |
vector of measurements from the primary studies |
vi |
vector of the variances of the measurements in yi |
c0 |
vector of the mixing parameters for the test statistics |
level |
the level of the confidence interval |
plot |
indicator whether to plot the contour of the confidence region |
tau2.bounds |
upper and lower bounds for the range of population variance values for constructing the confidence region; if NULL, value will be calculated from tau2.alpha |
resolution |
resolution of the population variance values for constructing the confidence region |
Z |
a matrix of length(yi) rows with each row consisting of standard normal samples to be used in the monte carlo estimation of the null distribution of the test statistic; if NULL, B values will be sampled per row |
B |
the number of monte carlo replicates per primary study observation to be used |
tau2.alpha |
the level of the exact CI with which to bounds on population variance when constructing the confidence region |
a matrix with length(c0) rows and each row containing the lower and upper endpoints of the confidence interval for the given mixing parameter
rma.exact for computing entire confidence regions
K <- 5 c0 <- 1 mu0 <- 0 tau2 <- 12.5 vi <- (seq(1, 5, length=K))^2 yi=rnorm(K)*sqrt(vi+tau2)+mu0 rma.exact.fast(yi=yi,vi=vi,level=.05)K <- 5 c0 <- 1 mu0 <- 0 tau2 <- 12.5 vi <- (seq(1, 5, length=K))^2 yi=rnorm(K)*sqrt(vi+tau2)+mu0 rma.exact.fast(yi=yi,vi=vi,level=.05)