
Calculate bootstrap outcomes or test statistics using cluster wild bootstrapping
Source:R/run_cwb.R
run_cwb.RdCalculate 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,
...,
retry = 1L,
auxiliary_dist = "Rademacher",
adjust = "CR0",
simplify = FALSE,
seed = NULL,
future_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.- retry
Number of times to repeat bootstrapping if
f()returnsNA. Default is 1, so that missing values are simply returned.- 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
TRUEindicating 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, including calculatingfresults on the bootstrap outcome vectors. 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.0923906926 -0.1674382877 0.3316639350 0.5916245439 0.1283641162
#> [6] 0.2048784687 0.3472946985 0.3278852418 0.3272878143 0.4515892451
#> [11] 0.0850257307 -0.0815549977 -0.1034473475 -0.2945713051 -0.1442122375
#> [16] -0.3449910225 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.0240429770 -0.0768172811
#> [31] -0.0680092931 0.3999739016 0.5751863508 0.5451985511 0.2219369751
#> [36] 0.0922842721 0.0847617900 0.0801884327 -0.0118110834 0.1382067586
#> [41] 0.0473444049 0.0002081057 0.1116041131 0.1821950393 0.2762093328
#> [46] 0.0542696819 0.0862626853 0.3158746243 0.0696778523 0.2130680810
#> [51] 0.0071288986 -0.4749416038 -0.3847473585 -0.2439234943 -0.0933183069
#> [56] -0.0410271486 0.6417824138 0.1442284061 0.3054807804 -0.5389696306
#> [61] 0.1206397515 0.2681584390 0.4782882586 0.4825617690 0.1309733683
#>
#> [[2]]
#> [1] 0.092390693 0.777200768 0.048009473 0.591624544 0.227655443
#> [6] 0.128922438 0.347294698 0.327885242 0.045936175 0.451589245
#> [11] 0.085025731 -0.081554998 0.185862437 0.399205046 0.226627327
#> [16] 0.449624764 -0.162611463 -0.062258107 -0.070294288 0.214757323
#> [21] -0.022296865 0.175213138 0.061887198 0.062977704 0.198822511
#> [26] 0.008871784 0.144390928 -0.192165989 -0.024042977 -0.076817281
#> [31] -0.068009293 0.399973902 0.575186351 0.545198551 0.221936975
#> [36] 0.092284272 0.140387907 0.141018956 0.201480007 0.043577548
#> [41] 0.047344405 0.496960856 0.218552707 0.125743129 0.053947488
#> [46] 0.253668487 0.086262685 -0.007936456 0.165075110 0.213068081
#> [51] 0.007128899 -0.474941604 0.586243206 -0.243923494 -0.093318307
#> [56] -0.041027149 -0.418067914 0.079486094 0.305480780 -0.538969631
#> [61] 0.120639752 0.268158439 0.478288259 -0.128751099 0.200618650
#>
#> [[3]]
#> [1] 0.0923906926 -0.1674382877 0.0480094729 0.5916245439 0.1283641162
#> [6] 0.2048784687 0.1269941059 0.1241849107 0.0459361746 -0.1349927680
#> [11] 0.2093520945 0.1861887390 -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.0232272222
#> [26] 0.3638389140 0.2061011175 0.3598766612 -0.0240429770 -0.0768172811
#> [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.1821950393 0.2762093328
#> [46] 0.0542696819 0.2438941353 -0.0079364555 0.1650751102 0.2130680810
#> [51] 0.1943669492 0.6764374516 -0.3847473585 0.4454193421 -0.0933183069
#> [56] -0.0410271486 -0.4180679142 0.0794860935 -0.0817662808 0.7626841302
#> [61] 0.1030747481 -0.0444439394 -0.2545737590 -0.1287510993 0.2006186495
#>
#> [[4]]
#> [1] 0.0923906926 0.7772007675 0.0480094729 0.5916245439 0.1283641162
#> [6] 0.2048784687 0.1269941059 0.3278852418 0.0459361746 -0.1349927680
#> [11] 0.2093520945 0.1861887390 -0.1034473475 -0.2945713051 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.2061011175 0.3598766612 -0.0240429770 -0.0768172811
#> [31] 0.5998475153 -0.2229434158 -0.3049756659 -0.2972065181 -0.0243834355
#> [36] 0.1289231166 0.0847617900 0.1410189560 -0.0118110834 0.1382067586
#> [41] 0.1817476002 0.4969608558 0.2185527075 0.1821950393 0.2762093328
#> [46] 0.2536684868 0.0862626853 0.3158746243 0.0696778523 0.2130680810
#> [51] 0.1943669492 -0.4749416038 0.5862432063 0.4454193421 0.2948141547
#> [56] -0.0410271486 0.6417824138 0.1442284061 -0.0817662808 0.7626841302
#> [61] 0.1030747481 -0.0444439394 -0.2545737590 0.4825617690 0.1309733683
#>
#> [[5]]
#> [1] 0.0923906926 0.7772007675 0.3316639350 0.5916245439 0.1283641162
#> [6] 0.2048784687 0.3472946985 0.3278852418 0.3272878143 -0.1349927680
#> [11] 0.0850257307 -0.0815549977 0.1858624369 0.3992050463 -0.1442122375
#> [16] -0.3449910225 -0.1626114626 -0.0622581072 -0.0702942884 0.2147573229
#> [21] 0.1756735021 0.0003821504 0.0914894382 0.0076104609 0.1988225107
#> [26] 0.0088717836 0.1443909283 -0.1921659891 -0.0240429770 -0.0768172811
#> [31] 0.5998475153 -0.2229434158 -0.3049756659 -0.2972065181 0.2219369751
#> [36] 0.0922842721 0.1403879069 0.0801884327 0.2014800066 0.0435775483
#> [41] 0.1817476002 0.4969608558 0.2185527075 0.1257431294 0.0539474878
#> [46] 0.0542696819 0.2438941353 0.3158746243 0.0696778523 -0.0005337703
#> [51] 0.1943669492 0.6764374516 -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.4825617690 0.1309733683
#>
#> [[6]]
#> [1] 0.5173717872 0.7772007675 0.3316639350 0.5916245439 0.2276554426
#> [6] 0.1289224383 0.1269941059 0.1241849107 0.3272878143 0.4515892451
#> [11] 0.2093520945 0.1861887390 -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.1988225107
#> [26] 0.0088717836 0.2061011175 0.3598766612 0.1695349973 0.6308741552
#> [31] 0.5998475153 -0.2229434158 0.5751863508 0.5451985511 0.2219369751
#> [36] 0.0922842721 0.1403879069 0.0801884327 0.2014800066 0.0435775483
#> [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.4454193421 0.2948141547
#> [56] -0.0410271486 0.6417824138 0.0794860935 0.3054807804 -0.5389696306
#> [61] 0.1206397515 0.2681584390 0.4782882586 0.4825617690 0.1309733683
#>
#> [[7]]
#> [1] 0.0923906926 0.7772007675 0.3316639350 0.5916245439 0.1283641162
#> [6] 0.1289224383 0.3472946985 0.3278852418 0.0459361746 -0.1349927680
#> [11] 0.0850257307 -0.0815549977 -0.1034473475 -0.2945713051 0.2266273269
#> [16] 0.4496247637 -0.1626114626 -0.0622581072 -0.0702942884 0.2147573229
#> [21] 0.1756735021 0.0003821504 0.0618871985 0.0629777039 0.1988225107
#> [26] 0.0088717836 0.1443909283 -0.1921659891 0.1695349973 0.6308741552
#> [31] -0.0680092931 0.3999739016 -0.3049756659 -0.2972065181 -0.0243834355
#> [36] 0.1289231166 0.0847617900 0.0801884327 0.2014800066 0.0435775483
#> [41] 0.1817476002 0.0002081057 0.1116041131 0.1821950393 0.2762093328
#> [46] 0.2536684868 0.2438941353 0.3158746243 0.1650751102 0.2130680810
#> [51] 0.0071288986 -0.4749416038 0.5862432063 -0.2439234943 0.2948141547
#> [56] -0.0410271486 0.6417824138 0.1442284061 -0.0817662808 -0.5389696306
#> [61] 0.1206397515 0.2681584390 0.4782882586 -0.1287510993 0.2006186495
#>
#> [[8]]
#> [1] 0.5173717872 0.7772007675 0.0480094729 -0.2341697878 0.1283641162
#> [6] 0.1289224383 0.1269941059 0.1241849107 0.0459361746 -0.1349927680
#> [11] 0.2093520945 0.1861887390 -0.1034473475 -0.2945713051 0.2266273269
#> [16] 0.4496247637 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.1695349973 0.6308741552
#> [31] -0.0680092931 0.3999739016 0.5751863508 0.5451985511 0.2219369751
#> [36] 0.0922842721 0.0847617900 0.1410189560 0.2014800066 0.0435775483
#> [41] 0.1817476002 0.0002081057 0.1116041131 0.1257431294 0.0539474878
#> [46] 0.0542696819 0.0862626853 0.3158746243 0.0696778523 0.2130680810
#> [51] 0.1943669492 0.6764374516 0.5862432063 -0.2439234943 0.2948141547
#> [56] 0.2647416483 0.6417824138 0.1442284061 -0.0817662808 -0.5389696306
#> [61] 0.1206397515 0.2681584390 0.4782882586 -0.1287510993 0.2006186495
#>
#> [[9]]
#> [1] 0.517371787 -0.167438288 0.331663935 0.591624544 0.227655443
#> [6] 0.204878469 0.126994106 0.124184911 0.327287814 0.451589245
#> [11] 0.209352094 0.186188739 -0.103447348 -0.294571305 0.226627327
#> [16] 0.449624764 -0.162611463 -0.062258107 0.152709378 -0.039162034
#> [21] -0.022296865 0.175213138 0.061887198 0.062977704 -0.023227222
#> [26] 0.363838914 0.144390928 -0.192165989 0.169534997 0.630874155
#> [31] -0.068009293 0.399973902 0.575186351 0.545198551 0.221936975
#> [36] 0.092284272 0.140387907 0.080188433 0.201480007 0.043577548
#> [41] 0.181747600 0.496960856 0.218552707 0.125743129 0.053947488
#> [46] 0.054269682 0.086262685 -0.007936456 0.069677852 0.213068081
#> [51] 0.194366949 0.676437452 -0.384747358 -0.243923494 0.294814155
#> [56] 0.264741648 0.641782414 0.144228406 0.305480780 0.762684130
#> [61] 0.103074748 -0.044443939 -0.254573759 -0.128751099 0.200618650
#>
#> [[10]]
#> [1] 0.0923906926 -0.1674382877 0.0480094729 -0.2341697878 0.2276554426
#> [6] 0.1289224383 0.3472946985 0.1241849107 0.0459361746 0.4515892451
#> [11] 0.2093520945 0.1861887390 -0.1034473475 -0.2945713051 -0.1442122375
#> [16] -0.3449910225 0.2450265520 0.1668918485 -0.0702942884 0.2147573229
#> [21] 0.1756735021 0.0003821504 0.0618871985 0.0629777039 0.1988225107
#> [26] 0.0088717836 0.1443909283 -0.1921659891 0.1695349973 0.6308741552
#> [31] 0.5998475153 -0.2229434158 0.5751863508 0.5451985511 -0.0243834355
#> [36] 0.1289231166 0.1403879069 0.1410189560 0.2014800066 0.0435775483
#> [41] 0.1817476002 0.4969608558 0.2185527075 0.1821950393 0.2762093328
#> [46] 0.2536684868 0.0862626853 -0.0079364555 0.1650751102 -0.0005337703
#> [51] 0.0071288986 -0.4749416038 -0.3847473585 0.4454193421 0.2948141547
#> [56] -0.0410271486 -0.4180679142 0.0794860935 -0.0817662808 -0.5389696306
#> [61] 0.1206397515 0.2681584390 0.4782882586 0.4825617690 0.1309733683
#>
#> [[11]]
#> [1] 0.517371787 -0.167438288 0.331663935 -0.234169788 0.227655443
#> [6] 0.128922438 0.126994106 0.124184911 0.045936175 0.451589245
#> [11] 0.209352094 0.186188739 0.185862437 0.399205046 0.226627327
#> [16] 0.449624764 0.245026552 0.166891848 0.152709378 -0.039162034
#> [21] -0.022296865 0.175213138 0.091489438 0.007610461 -0.023227222
#> [26] 0.363838914 0.144390928 -0.192165989 0.169534997 0.630874155
#> [31] -0.068009293 0.399973902 -0.304975666 -0.297206518 -0.024383436
#> [36] 0.128923117 0.084761790 0.141018956 0.201480007 0.043577548
#> [41] 0.047344405 0.496960856 0.218552707 0.125743129 0.053947488
#> [46] 0.054269682 0.243894135 -0.007936456 0.069677852 0.213068081
#> [51] 0.007128899 0.676437452 -0.384747358 0.445419342 -0.093318307
#> [56] -0.041027149 -0.418067914 0.144228406 0.305480780 0.762684130
#> [61] 0.103074748 -0.044443939 -0.254573759 0.482561769 0.130973368
#>
#> [[12]]
#> [1] 0.0923906926 -0.1674382877 0.3316639350 0.5916245439 0.2276554426
#> [6] 0.1289224383 0.1269941059 0.1241849107 0.3272878143 0.4515892451
#> [11] 0.2093520945 0.1861887390 0.1858624369 0.3992050463 0.2266273269
#> [16] 0.4496247637 0.2450265520 0.1668918485 -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.1403879069 0.1410189560 -0.0118110834 0.1382067586
#> [41] 0.0473444049 0.0002081057 0.1116041131 0.1257431294 0.0539474878
#> [46] 0.2536684868 0.0862626853 0.3158746243 0.0696778523 -0.0005337703
#> [51] 0.1943669492 0.6764374516 0.5862432063 0.4454193421 -0.0933183069
#> [56] -0.0410271486 -0.4180679142 0.1442284061 -0.0817662808 -0.5389696306
#> [61] 0.1206397515 0.2681584390 0.4782882586 -0.1287510993 0.2006186495
#>