run_cwb: Calculate bootstrap outcomes or test statistics using cluster...

View source: R/run_cwb.R

run_cwbR Documentation

Calculate bootstrap outcomes or test statistics using cluster wild bootstrapping

Description

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().

Usage

run_cwb(
  model,
  cluster,
  R,
  f = NULL,
  ...,
  auxiliary_dist = "Rademacher",
  adjust = "CR0",
  simplify = FALSE,
  seed = NULL,
  future_args = NULL,
  future_f_args = NULL
)

Arguments

model

Fitted robumeta::robu(), metafor::rma.mv(), or metafor::rma.uni() model. For cluster wild bootstrapping, a null model is recommended, with null model indicating a model containing all variables except the ones being tested.

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 NULL (the default), this function returns a list containing bootstrapped outcomes.

...

Optional arguments to be passed to the function specified in f.

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 "CRO", "CR1", "CR2", "CR3", or "CR4", with a default of "CRO".

simplify

Logical, with TRUE indicating the bootstrapped outcomes or F statistics will be simplified to a vector or matrix and FALSE (the default) indicating the results will be returned as a list.

seed

Optional seed value to ensure reproducibility.

future_args

Optional list of additional arguments passed to the future_*() functions used in calculating results across bootstrap replications. Ignored if the future.apply package is not available.

future_f_args

Optional list of additional arguments passed to the future_*() function used in calculating f results (but not bootstrap outcome vectors) across bootstrap replications. Ignored if the future.apply package is not available.

Value

A list or matrix containing either the bootstrapped outcomes or bootstrapped test statistics.

Examples

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

wildmeta documentation built on March 31, 2023, 5:23 p.m.