Title: | Cluster Wild Bootstrapping for Meta-Analysis |
---|---|
Description: | Conducts single coefficient tests and multiple-contrast hypothesis tests of meta-regression models using cluster wild bootstrapping, based on methods examined in Joshi, Pustejovsky, and Beretvas (2022) <DOI:10.1002/jrsm.1554>. |
Authors: | Megha Joshi [aut, cre] |
Maintainer: | Megha Joshi <[email protected]> |
License: | GPL-3 |
Version: | 0.3.2 |
Built: | 2025-02-11 06:14:49 UTC |
Source: | https://github.com/meghapsimatrix/wildmeta |
Creates a density plot showing the distribution of bootstrap test statistics.
## S3 method for class 'Wald_test_wildmeta' plot(x, ...)
## S3 method for class 'Wald_test_wildmeta' plot(x, ...)
x |
Results from Wald_test_cwb function |
... |
Any other arguments to be passed to |
A ggplot2 density plot.
data("SATcoaching", package = "clubSandwich") library(clubSandwich) library(robumeta) full_model <- robu(d ~ 0 + study_type + hrs + test, studynum = study, var.eff.size = V, small = FALSE, data = SATcoaching) res <- Wald_test_cwb(full_model = full_model, constraints = constrain_equal(1:3), R = 99) if (requireNamespace("ggplot2", quietly = TRUE)) { plot(res, fill = "darkred", alpha = 0.5) }
data("SATcoaching", package = "clubSandwich") library(clubSandwich) library(robumeta) full_model <- robu(d ~ 0 + study_type + hrs + test, studynum = study, var.eff.size = V, small = FALSE, data = SATcoaching) res <- Wald_test_cwb(full_model = full_model, constraints = constrain_equal(1:3), R = 99) if (requireNamespace("ggplot2", quietly = TRUE)) { plot(res, fill = "darkred", alpha = 0.5) }
Calculate bootstrap outcomes or test statistics using cluster
wild bootstrapping for meta-analytic models fit using
robumeta::robu()
, metafor::rma.mv()
, and metafor::rma.uni()
.
run_cwb( model, cluster, R, f = NULL, ..., auxiliary_dist = "Rademacher", adjust = "CR0", simplify = FALSE, seed = NULL, future_args = NULL, future_f_args = NULL )
run_cwb( model, cluster, R, f = NULL, ..., auxiliary_dist = "Rademacher", adjust = "CR0", simplify = FALSE, seed = NULL, future_args = NULL, future_f_args = NULL )
model |
Fitted |
cluster |
Vector indicating which observations belong to the same cluster. |
R |
Number of bootstrap replications. |
f |
Optional function to be used to calculate bootstrap test statistics
based on the bootstrapped outcomes. If f is |
... |
Optional arguments to be passed to the function specified in
|
auxiliary_dist |
Character string indicating the auxiliary distribution to be used for cluster wild bootstrapping, with available options: "Rademacher", "Mammen", "Webb six", "uniform", "standard normal". The default is set to "Rademacher." We recommend the Rademacher distribution for models that have at least 10 clusters. For models with less than 10 clusters, we recommend the use of "Webb six" distribution. |
adjust |
Character string specifying which small-sample adjustment
should be used to multiply the residuals by. The available options are
|
simplify |
Logical, with |
seed |
Optional seed value to ensure reproducibility. |
future_args |
Optional list of additional arguments passed to the
|
future_f_args |
Optional list of additional arguments passed to the
|
A list or matrix containing either the bootstrapped outcomes or bootstrapped test statistics.
library(clubSandwich) library(robumeta) model <- robu(d ~ 0 + study_type + hrs + test, studynum = study, var.eff.size = V, small = FALSE, data = SATcoaching) bootstraps <- run_cwb( model = model, cluster = model$data.full$study, R = 12, adjust = "CR2", simplify = FALSE ) bootstraps
library(clubSandwich) library(robumeta) model <- robu(d ~ 0 + study_type + hrs + test, studynum = study, var.eff.size = V, small = FALSE, data = SATcoaching) bootstraps <- run_cwb( model = model, cluster = model$data.full$study, R = 12, adjust = "CR2", simplify = FALSE ) bootstraps
Calculate p-values for single coefficient and multiple contrast hypothesis tests using cluster wild bootstrapping.
Wald_test_cwb( full_model, constraints, R, cluster = NULL, auxiliary_dist = "Rademacher", adjust = "CR0", type = "CR0", test = "Naive-F", seed = NULL, future_args = NULL )
Wald_test_cwb( full_model, constraints, R, cluster = NULL, auxiliary_dist = "Rademacher", adjust = "CR0", type = "CR0", test = "Naive-F", seed = NULL, future_args = NULL )
full_model |
Model fit using |
constraints |
A q X p constraint matrix be tested. Alternately, a
function to create such a matrix, specified using
|
R |
Number of bootstrap replications. |
cluster |
Vector of identifiers indicating which observations
belong to the same cluster. If |
auxiliary_dist |
Character string indicating the auxiliary distribution to be used for cluster wild bootstrapping, with available options: "Rademacher", "Mammen", "Webb six", "uniform", "standard normal". The default is set to "Rademacher." We recommend the Rademacher distribution for models that have at least 10 clusters. For models with less than 10 clusters, we recommend the use of "Webb six" distribution. |
adjust |
Character string specifying which small-sample adjustment
should be used to multiply the residuals by. The available options are
|
type |
Character string specifying which small-sample adjustment is used
to calculate the Wald test statistic. The available options are
|
test |
Character string specifying which (if any) small-sample
adjustment is used in calculating the test statistic. Default is
|
seed |
Optional seed value to ensure reproducibility. |
future_args |
Optional list of additional arguments passed to the
|
A data.frame
containing the name of the test, the adjustment
used for the bootstrap process, the type of variance-covariance matrix
used, the type of test statistic, the number of bootstrap replicates, and
the bootstrapped p-value.
library(clubSandwich) library(robumeta) model <- robu(d ~ 0 + study_type + hrs + test, studynum = study, var.eff.size = V, small = FALSE, data = SATcoaching) C_mat <- constrain_equal(1:3, coefs = coef(model)) Wald_test_cwb(full_model = model, constraints = C_mat, R = 12) # Equivalent, using constrain_equal() Wald_test_cwb(full_model = model, constraints = constrain_equal(1:3), R = 12)
library(clubSandwich) library(robumeta) model <- robu(d ~ 0 + study_type + hrs + test, studynum = study, var.eff.size = V, small = FALSE, data = SATcoaching) C_mat <- constrain_equal(1:3, coefs = coef(model)) Wald_test_cwb(full_model = model, constraints = C_mat, R = 12) # Equivalent, using constrain_equal() Wald_test_cwb(full_model = model, constraints = constrain_equal(1:3), R = 12)