Calculate bootstrap outcomes or test statistics using cluster wild bootstrapping
Source:R/run_cwb.R
run_cwb.Rd
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()
, ormetafor::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 andFALSE
(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 calculatingf
results (but not bootstrap outcome vectors) across bootstrap replications. Ignored if the future.apply package is not available.
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
#> [[1]]
#> [1] 0.5173717872 0.7772007675 0.3316639350 -0.2341697878 0.1283641162
#> [6] 0.1289224383 0.1269941059 0.1241849107 0.3272878143 -0.1349927680
#> [11] 0.0850257307 -0.0815549977 -0.1034473475 -0.2945713051 0.2266273269
#> [16] 0.4496247637 0.2450265520 0.1668918485 -0.0702942884 0.2147573229
#> [21] 0.1756735021 0.0003821504 0.0618871985 0.0629777039 -0.0232272222
#> [26] 0.3638389140 0.1443909283 -0.1921659891 -0.0240429770 -0.0768172811
#> [31] 0.5998475153 -0.2229434158 0.5751863508 0.5451985511 0.2219369751
#> [36] 0.0922842721 0.0847617900 0.0801884327 -0.0118110834 0.1382067586
#> [41] 0.0473444049 0.4969608558 0.2185527075 0.1257431294 0.0539474878
#> [46] 0.0542696819 0.2438941353 -0.0079364555 0.1650751102 -0.0005337703
#> [51] 0.1943669492 0.6764374516 0.5862432063 0.4454193421 -0.0933183069
#> [56] -0.0410271486 0.6417824138 0.0794860935 -0.0817662808 0.7626841302
#> [61] 0.1030747481 -0.0444439394 -0.2545737590 0.4825617690 0.1309733683
#>
#> [[2]]
#> [1] 0.5173717872 -0.1674382877 0.0480094729 -0.2341697878 0.1283641162
#> [6] 0.1289224383 0.1269941059 0.3278852418 0.3272878143 0.4515892451
#> [11] 0.2093520945 0.1861887390 -0.1034473475 -0.2945713051 0.2266273269
#> [16] 0.4496247637 -0.1626114626 -0.0622581072 0.1527093778 -0.0391620344
#> [21] 0.1756735021 0.0003821504 0.0914894382 0.0076104609 -0.0232272222
#> [26] 0.3638389140 0.2061011175 0.3598766612 0.1695349973 0.6308741552
#> [31] -0.0680092931 0.3999739016 -0.3049756659 -0.2972065181 -0.0243834355
#> [36] 0.1289231166 0.0847617900 0.1410189560 0.2014800066 0.0435775483
#> [41] 0.1817476002 0.4969608558 0.2185527075 0.1257431294 0.0539474878
#> [46] 0.0542696819 0.0862626853 -0.0079364555 0.0696778523 -0.0005337703
#> [51] 0.0071288986 0.6764374516 0.5862432063 0.4454193421 0.2948141547
#> [56] -0.0410271486 0.6417824138 0.1442284061 -0.0817662808 -0.5389696306
#> [61] 0.1206397515 -0.0444439394 -0.2545737590 0.4825617690 0.1309733683
#>
#> [[3]]
#> [1] 0.51737179 -0.16743829 0.04800947 0.59162454 0.22765544 0.20487847
#> [7] 0.34729470 0.12418491 0.04593617 -0.13499277 0.20935209 0.18618874
#> [13] 0.18586244 0.39920505 -0.14421224 -0.34499102 -0.16261146 -0.06225811
#> [19] -0.07029429 0.21475732 -0.02229687 0.17521314 0.06188720 0.06297770
#> [25] -0.02322722 0.36383891 0.20610112 0.35987666 0.16953500 0.63087416
#> [31] 0.59984752 -0.22294342 -0.30497567 -0.29720652 0.22193698 0.09228427
#> [37] 0.08476179 0.08018843 -0.01181108 0.13820676 0.04734440 0.49696086
#> [43] 0.21855271 0.12574313 0.05394749 0.25366849 0.24389414 0.31587462
#> [49] 0.16507511 0.21306808 0.19436695 -0.47494160 -0.38474736 0.44541934
#> [55] -0.09331831 -0.04102715 -0.41806791 0.14422841 -0.08176628 -0.53896963
#> [61] 0.12063975 0.26815844 0.47828826 0.48256177 0.13097337
#>
#> [[4]]
#> [1] 0.5173717872 0.7772007675 0.0480094729 0.5916245439 0.2276554426
#> [6] 0.2048784687 0.1269941059 0.3278852418 0.3272878143 -0.1349927680
#> [11] 0.2093520945 0.1861887390 0.1858624369 0.3992050463 0.2266273269
#> [16] 0.4496247637 0.2450265520 0.1668918485 -0.0702942884 0.2147573229
#> [21] 0.1756735021 0.0003821504 0.0914894382 0.0076104609 -0.0232272222
#> [26] 0.3638389140 0.1443909283 -0.1921659891 0.1695349973 0.6308741552
#> [31] 0.5998475153 -0.2229434158 -0.3049756659 -0.2972065181 -0.0243834355
#> [36] 0.1289231166 0.1403879069 0.1410189560 -0.0118110834 0.1382067586
#> [41] 0.1817476002 0.0002081057 0.1116041131 0.1257431294 0.0539474878
#> [46] 0.0542696819 0.0862626853 -0.0079364555 0.1650751102 0.2130680810
#> [51] 0.1943669492 -0.4749416038 0.5862432063 -0.2439234943 -0.0933183069
#> [56] -0.0410271486 0.6417824138 0.1442284061 0.3054807804 -0.5389696306
#> [61] 0.1206397515 0.2681584390 0.4782882586 -0.1287510993 0.2006186495
#>
#> [[5]]
#> [1] 0.5173717872 -0.1674382877 0.0480094729 0.5916245439 0.2276554426
#> [6] 0.1289224383 0.3472946985 0.1241849107 0.3272878143 -0.1349927680
#> [11] 0.2093520945 0.1861887390 0.1858624369 0.3992050463 0.2266273269
#> [16] 0.4496247637 -0.1626114626 -0.0622581072 0.1527093778 -0.0391620344
#> [21] -0.0222968655 0.1752131381 0.0618871985 0.0629777039 0.1988225107
#> [26] 0.0088717836 0.1443909283 -0.1921659891 0.1695349973 0.6308741552
#> [31] -0.0680092931 0.3999739016 0.5751863508 0.5451985511 -0.0243834355
#> [36] 0.1289231166 0.1403879069 0.0801884327 -0.0118110834 0.1382067586
#> [41] 0.1817476002 0.0002081057 0.1116041131 0.1257431294 0.0539474878
#> [46] 0.2536684868 0.2438941353 -0.0079364555 0.1650751102 -0.0005337703
#> [51] 0.1943669492 -0.4749416038 -0.3847473585 0.4454193421 0.2948141547
#> [56] 0.2647416483 -0.4180679142 0.1442284061 0.3054807804 -0.5389696306
#> [61] 0.1206397515 0.2681584390 0.4782882586 -0.1287510993 0.2006186495
#>
#> [[6]]
#> [1] 0.5173717872 -0.1674382877 0.3316639350 0.5916245439 0.2276554426
#> [6] 0.2048784687 0.1269941059 0.3278852418 0.0459361746 0.4515892451
#> [11] 0.0850257307 -0.0815549977 -0.1034473475 -0.2945713051 0.2266273269
#> [16] 0.4496247637 -0.1626114626 -0.0622581072 -0.0702942884 0.2147573229
#> [21] -0.0222968655 0.1752131381 0.0618871985 0.0629777039 0.1988225107
#> [26] 0.0088717836 0.2061011175 0.3598766612 -0.0240429770 -0.0768172811
#> [31] -0.0680092931 0.3999739016 0.5751863508 0.5451985511 -0.0243834355
#> [36] 0.1289231166 0.1403879069 0.1410189560 -0.0118110834 0.1382067586
#> [41] 0.1817476002 0.4969608558 0.2185527075 0.1821950393 0.2762093328
#> [46] 0.2536684868 0.0862626853 -0.0079364555 0.0696778523 -0.0005337703
#> [51] 0.0071288986 -0.4749416038 -0.3847473585 0.4454193421 0.2948141547
#> [56] 0.2647416483 0.6417824138 0.1442284061 0.3054807804 0.7626841302
#> [61] 0.1030747481 0.2681584390 0.4782882586 -0.1287510993 0.2006186495
#>
#> [[7]]
#> [1] 0.5173717872 -0.1674382877 0.0480094729 -0.2341697878 0.1283641162
#> [6] 0.2048784687 0.3472946985 0.3278852418 0.3272878143 -0.1349927680
#> [11] 0.0850257307 -0.0815549977 -0.1034473475 -0.2945713051 0.2266273269
#> [16] 0.4496247637 -0.1626114626 -0.0622581072 0.1527093778 -0.0391620344
#> [21] -0.0222968655 0.1752131381 0.0914894382 0.0076104609 -0.0232272222
#> [26] 0.3638389140 0.2061011175 0.3598766612 0.1695349973 0.6308741552
#> [31] -0.0680092931 0.3999739016 -0.3049756659 -0.2972065181 -0.0243834355
#> [36] 0.1289231166 0.1403879069 0.1410189560 -0.0118110834 0.1382067586
#> [41] 0.1817476002 0.0002081057 0.1116041131 0.1821950393 0.2762093328
#> [46] 0.0542696819 0.0862626853 0.3158746243 0.0696778523 -0.0005337703
#> [51] 0.1943669492 0.6764374516 0.5862432063 -0.2439234943 0.2948141547
#> [56] -0.0410271486 0.6417824138 0.0794860935 -0.0817662808 0.7626841302
#> [61] 0.1030747481 -0.0444439394 -0.2545737590 -0.1287510993 0.2006186495
#>
#> [[8]]
#> [1] 0.5173717872 -0.1674382877 0.3316639350 0.5916245439 0.1283641162
#> [6] 0.1289224383 0.3472946985 0.3278852418 0.0459361746 0.4515892451
#> [11] 0.0850257307 -0.0815549977 -0.1034473475 -0.2945713051 -0.1442122375
#> [16] -0.3449910225 0.2450265520 0.1668918485 0.1527093778 -0.0391620344
#> [21] -0.0222968655 0.1752131381 0.0914894382 0.0076104609 -0.0232272222
#> [26] 0.3638389140 0.2061011175 0.3598766612 0.1695349973 0.6308741552
#> [31] 0.5998475153 -0.2229434158 -0.3049756659 -0.2972065181 -0.0243834355
#> [36] 0.1289231166 0.1403879069 0.0801884327 -0.0118110834 0.1382067586
#> [41] 0.0473444049 0.4969608558 0.2185527075 0.1821950393 0.2762093328
#> [46] 0.2536684868 0.0862626853 0.3158746243 0.0696778523 -0.0005337703
#> [51] 0.1943669492 -0.4749416038 -0.3847473585 0.4454193421 0.2948141547
#> [56] -0.0410271486 -0.4180679142 0.0794860935 0.3054807804 -0.5389696306
#> [61] 0.1206397515 -0.0444439394 -0.2545737590 0.4825617690 0.1309733683
#>
#> [[9]]
#> [1] 0.092390693 0.777200768 0.048009473 0.591624544 0.128364116
#> [6] 0.128922438 0.126994106 0.124184911 0.045936175 0.451589245
#> [11] 0.085025731 -0.081554998 0.185862437 0.399205046 -0.144212238
#> [16] -0.344991022 -0.162611463 -0.062258107 -0.070294288 0.214757323
#> [21] -0.022296865 0.175213138 0.091489438 0.007610461 0.198822511
#> [26] 0.008871784 0.206101118 0.359876661 -0.024042977 -0.076817281
#> [31] -0.068009293 0.399973902 -0.304975666 -0.297206518 -0.024383436
#> [36] 0.128923117 0.084761790 0.141018956 0.201480007 0.043577548
#> [41] 0.181747600 0.496960856 0.218552707 0.182195039 0.276209333
#> [46] 0.054269682 0.086262685 -0.007936456 0.069677852 0.213068081
#> [51] 0.194366949 -0.474941604 -0.384747358 -0.243923494 -0.093318307
#> [56] 0.264741648 -0.418067914 0.079486094 -0.081766281 -0.538969631
#> [61] 0.120639752 -0.044443939 -0.254573759 -0.128751099 0.200618650
#>
#> [[10]]
#> [1] 0.0923906926 0.7772007675 0.3316639350 0.5916245439 0.1283641162
#> [6] 0.1289224383 0.1269941059 0.3278852418 0.0459361746 -0.1349927680
#> [11] 0.2093520945 0.1861887390 -0.1034473475 -0.2945713051 -0.1442122375
#> [16] -0.3449910225 0.2450265520 0.1668918485 -0.0702942884 0.2147573229
#> [21] -0.0222968655 0.1752131381 0.0618871985 0.0629777039 0.1988225107
#> [26] 0.0088717836 0.2061011175 0.3598766612 -0.0240429770 -0.0768172811
#> [31] -0.0680092931 0.3999739016 0.5751863508 0.5451985511 0.2219369751
#> [36] 0.0922842721 0.0847617900 0.0801884327 0.2014800066 0.0435775483
#> [41] 0.1817476002 0.0002081057 0.1116041131 0.1257431294 0.0539474878
#> [46] 0.2536684868 0.0862626853 0.3158746243 0.1650751102 0.2130680810
#> [51] 0.1943669492 -0.4749416038 -0.3847473585 -0.2439234943 0.2948141547
#> [56] 0.2647416483 -0.4180679142 0.1442284061 -0.0817662808 -0.5389696306
#> [61] 0.1206397515 0.2681584390 0.4782882586 0.4825617690 0.1309733683
#>
#> [[11]]
#> [1] 0.0923906926 -0.1674382877 0.0480094729 0.5916245439 0.1283641162
#> [6] 0.2048784687 0.3472946985 0.3278852418 0.3272878143 0.4515892451
#> [11] 0.2093520945 0.1861887390 0.1858624369 0.3992050463 -0.1442122375
#> [16] -0.3449910225 0.2450265520 0.1668918485 0.1527093778 -0.0391620344
#> [21] 0.1756735021 0.0003821504 0.0914894382 0.0076104609 -0.0232272222
#> [26] 0.3638389140 0.1443909283 -0.1921659891 0.1695349973 0.6308741552
#> [31] -0.0680092931 0.3999739016 0.5751863508 0.5451985511 -0.0243834355
#> [36] 0.1289231166 0.0847617900 0.0801884327 -0.0118110834 0.1382067586
#> [41] 0.1817476002 0.0002081057 0.1116041131 0.1821950393 0.2762093328
#> [46] 0.0542696819 0.0862626853 0.3158746243 0.1650751102 0.2130680810
#> [51] 0.0071288986 -0.4749416038 -0.3847473585 0.4454193421 0.2948141547
#> [56] -0.0410271486 -0.4180679142 0.1442284061 0.3054807804 -0.5389696306
#> [61] 0.1206397515 -0.0444439394 -0.2545737590 0.4825617690 0.1309733683
#>
#> [[12]]
#> [1] 0.0923906926 0.7772007675 0.3316639350 0.5916245439 0.2276554426
#> [6] 0.2048784687 0.1269941059 0.1241849107 0.3272878143 0.4515892451
#> [11] 0.2093520945 0.1861887390 0.1858624369 0.3992050463 0.2266273269
#> [16] 0.4496247637 -0.1626114626 -0.0622581072 -0.0702942884 0.2147573229
#> [21] -0.0222968655 0.1752131381 0.0618871985 0.0629777039 0.1988225107
#> [26] 0.0088717836 0.1443909283 -0.1921659891 0.1695349973 0.6308741552
#> [31] -0.0680092931 0.3999739016 0.5751863508 0.5451985511 0.2219369751
#> [36] 0.0922842721 0.0847617900 0.1410189560 -0.0118110834 0.1382067586
#> [41] 0.1817476002 0.0002081057 0.1116041131 0.1257431294 0.0539474878
#> [46] 0.2536684868 0.2438941353 0.3158746243 0.1650751102 0.2130680810
#> [51] 0.0071288986 -0.4749416038 0.5862432063 0.4454193421 -0.0933183069
#> [56] 0.2647416483 -0.4180679142 0.1442284061 -0.0817662808 -0.5389696306
#> [61] 0.1206397515 -0.0444439394 -0.2545737590 0.4825617690 0.1309733683
#>