Skip to content

Commit

Permalink
name samples based on number and distribution
Browse files Browse the repository at this point in the history
  • Loading branch information
joethorley committed Jan 6, 2024
1 parent 0055597 commit 13d6362
Show file tree
Hide file tree
Showing 56 changed files with 819 additions and 513 deletions.
7 changes: 4 additions & 3 deletions R/boot.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ generate_data <- function(dist, data, args, weighted, censoring, parametric) {
sample_parametric(dist, args = args, weighted = weighted, censoring = censoring)
}

boot_filename <- function(i, dist, prefix, ext) {
paste0(prefix, "_", stringr::str_pad(i, width = 9, pad = "0"), "_", dist, ext)
boot_filename <- function(i, dist, prefix, ext = NULL, sep = "_") {
paste0(prefix, sep, stringr::str_pad(i, width = 9, pad = "0"), sep, dist, ext)
}

boot_filepath <- function(i, dist, save_to, prefix = "data", ext = ".csv") {
Expand Down Expand Up @@ -125,6 +125,7 @@ boot_estimates <- function(fun, dist, estimates, pars, nboot, data, weighted, ce
wts = wts,
.options = furrr::furrr_options(seed = seeds)
)
names(estimates) <- 1:length(estimates)
names(estimates) <- boot_filename(1:length(estimates), prefix = "", sep = "",
dist = paste0("_", dist))
estimates[!vapply(estimates, is.null, TRUE)]
}
8 changes: 4 additions & 4 deletions tests/testthat/_snaps/bcanz/hc_chloride.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
dist,percent,est,se,lcl,ucl,wt,method,nboot,pboot,samples
average,1,0.267258,0.110132,0.0373797,0.336421,1,parametric,10,0.8,"c(`1` = 0.0498357, `2` = 0.140521, `3` = 0.119988, `4` = 0.357877, `7` = 0.235275, `8` = 0.0877111, `9` = 0.231497, `10` = 0.0347375)"
average,5,1.25677,0.426673,0.395098,1.58918,1,parametric,10,0.8,"c(`1` = 0.482142, `2` = 0.809011, `3` = 0.70282, `4` = 1.66801, `7` = 1.21757, `8` = 0.622321, `9` = 1.04335, `10` = 0.376634)"
average,10,2.38165,0.729251,1.01781,3.05366,1,parametric,10,0.8,"c(`1` = 1.1536, `2` = 1.64401, `3` = 1.56118, `4` = 3.19172, `7` = 2.40284, `8` = 1.32288, `9` = 2.00015, `10` = 0.989005)"
average,20,4.81004,1.247,2.733,6.16935,1,parametric,10,0.8,"c(`1` = 2.86462, `2` = 3.47234, `3` = 3.72708, `4` = 6.43412, `7` = 4.92113, `8` = 3.07383, `9` = 4.06054, `10` = 2.70508)"
average,1,0.267258,0.110132,0.0373797,0.336421,1,parametric,10,0.8,"c(`000000001_multi` = 0.0498357, `000000002_multi` = 0.140521, `000000003_multi` = 0.119988, `000000004_multi` = 0.357877, `000000007_multi` = 0.235275, `000000008_multi` = 0.0877111, `000000009_multi` = 0.231497, `000000010_multi` = 0.0347375)"
average,5,1.25677,0.426673,0.395098,1.58918,1,parametric,10,0.8,"c(`000000001_multi` = 0.482142, `000000002_multi` = 0.809011, `000000003_multi` = 0.70282, `000000004_multi` = 1.66801, `000000007_multi` = 1.21757, `000000008_multi` = 0.622321, `000000009_multi` = 1.04335, `000000010_multi` = 0.376634)"
average,10,2.38165,0.729251,1.01781,3.05366,1,parametric,10,0.8,"c(`000000001_multi` = 1.1536, `000000002_multi` = 1.64401, `000000003_multi` = 1.56118, `000000004_multi` = 3.19172, `000000007_multi` = 2.40284, `000000008_multi` = 1.32288, `000000009_multi` = 2.00015, `000000010_multi` = 0.989005)"
average,20,4.81004,1.247,2.733,6.16935,1,parametric,10,0.8,"c(`000000001_multi` = 2.86462, `000000002_multi` = 3.47234, `000000003_multi` = 3.72708, `000000004_multi` = 6.43412, `000000007_multi` = 4.92113, `000000008_multi` = 3.07383, `000000009_multi` = 4.06054, `000000010_multi` = 2.70508)"
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/burrIII3/hc_chloride.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
dist,percent,est,se,lcl,ucl,wt,method,nboot,pboot,samples
average,5,78.2897,66.6679,49.5803,241.121,1,parametric,10,1,"c(`1` = 275.866, `2` = 68.0712, `3` = 69.1215, `4` = 87.1669, `5` = 99.0681, `6` = 75.2955, `7` = 49.5406, `8` = 121.446, `9` = 49.7169, `10` = 69.8141)"
average,5,78.2897,66.6679,49.5803,241.121,1,parametric,10,1,"c(`000000001_burrIII3` = 275.866, `000000002_burrIII3` = 68.0712, `000000003_burrIII3` = 69.1215, `000000004_burrIII3` = 87.1669, `000000005_burrIII3` = 99.0681, `000000006_burrIII3` = 75.2955, `000000007_burrIII3` = 49.5406, `000000008_burrIII3` = 121.446, `000000009_burrIII3` = 49.7169, `000000010_burrIII3` = 69.8141)"
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/burrIII3/hc_uranium.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
dist,percent,est,se,lcl,ucl,wt,method,nboot,pboot,samples
average,5,16.7034,19.9308,4.02109,58.4951,1,parametric,10,1,"c(`1` = 64.5764, `2` = 5.34432, `3` = 7.7973, `4` = 4.32216, `5` = 10.0636, `6` = 10.8304, `7` = 5.65714, `8` = 37.5486, `9` = 4.96084, `10` = 3.93368)"
average,5,16.7034,19.9308,4.02109,58.4951,1,parametric,10,1,"c(`000000001_burrIII3` = 64.5764, `000000002_burrIII3` = 5.34432, `000000003_burrIII3` = 7.7973, `000000004_burrIII3` = 4.32216, `000000005_burrIII3` = 10.0636, `000000006_burrIII3` = 10.8304, `000000007_burrIII3` = 5.65714, `000000008_burrIII3` = 37.5486, `000000009_burrIII3` = 4.96084, `000000010_burrIII3` = 3.93368)"
10 changes: 6 additions & 4 deletions tests/testthat/_snaps/gompertz/hc_prob.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
dist,percent,est,se,lcl,ucl,wt,method,nboot,pboot,samples
average,5,0.179431,0.307761,0.0992247,1.2374,1,parametric,100,0.92,"c(`1` = 0.232636, `3` = 0.104637, `4` = 0.546398, `5` = 0.597141, `6` = 0.232612, `7` = 0.260431, `8` = 0.194922, `9` = 0.687422, `10` = 0.158599, `11` = 0.252416, `12` = 0.212662, `13` = 1.32511, `14` = 0.196367, `15` = 0.556544, `16` = 0.542006, `17` = 0.258814, `18` = 0.467321, `19` = 0.444488, `20` = 0.252327, `21` = 1.00609, `22` = 0.262124, `23` = 0.201934, `24` = 0.221751, `25` = 0.370771, `26` = 0.381563, `27` = 0.587611, `28` = 0.154166, `31` = 0.104224, `32` = 0.249995, `33` = 0.462125,
`34` = 0.396521, `35` = 0, `36` = 0.258785, `37` = 0.242243, `38` = 0.347565, `39` = 0.294371, `40` = 1.14334, `41` = 0.135071, `42` = 0.119921, `43` = 0.313962, `44` = 0.0979543, `45` = 0.135268, `46` = 0.260895, `47` = 0.507332, `49` = 1.83762, `50` = 0.183626, `51` = 0.119591, `52` = 0.166217, `53` = 0.375883, `54` = 0.159972, `55` = 0.378644, `56` = 0.198184, `57` = 0.854106, `58` = 0.113661, `59` = 0.0460331, `60` = 0.261158, `61` = 0.349721, `62` = 0.155654, `63` = 0.257054, `65` = 0.862269,
`66` = 0.252522, `67` = 1.27307, `68` = 0.306418, `69` = 0.102574, `71` = 0.882302, `72` = 0.738851, `74` = 0.290652, `75` = 0.427994, `76` = 0.325665, `77` = 0.260397, `78` = 0.331447, `79` = 1.05246, `80` = 0.616053, `81` = 0.183084, `82` = 0.18414, `83` = 0.141403, `84` = 0.324513, `85` = 0.366182, `86` = 0.671934, `87` = 0.274896, `88` = 0.283223, `89` = 0.252231, `90` = 0.24439, `91` = 0.109753, `92` = 0.192221, `93` = 0.15623, `94` = 0.392484, `95` = 0.171969, `96` = 0.217711, `97` = 0.54861,
`98` = 0.431443, `100` = 0.298392)"
average,5,0.179431,0.307761,0.0992247,1.2374,1,parametric,100,0.92,"c(`000000001_gompertz` = 0.232636, `000000003_gompertz` = 0.104637, `000000004_gompertz` = 0.546398, `000000005_gompertz` = 0.597141, `000000006_gompertz` = 0.232612, `000000007_gompertz` = 0.260431, `000000008_gompertz` = 0.194922, `000000009_gompertz` = 0.687422, `000000010_gompertz` = 0.158599, `000000011_gompertz` = 0.252416, `000000012_gompertz` = 0.212662, `000000013_gompertz` = 1.32511, `000000014_gompertz` = 0.196367, `000000015_gompertz` = 0.556544, `000000016_gompertz` = 0.542006, `000000017_gompertz` = 0.258814,
`000000018_gompertz` = 0.467321, `000000019_gompertz` = 0.444488, `000000020_gompertz` = 0.252327, `000000021_gompertz` = 1.00609, `000000022_gompertz` = 0.262124, `000000023_gompertz` = 0.201934, `000000024_gompertz` = 0.221751, `000000025_gompertz` = 0.370771, `000000026_gompertz` = 0.381563, `000000027_gompertz` = 0.587611, `000000028_gompertz` = 0.154166, `000000031_gompertz` = 0.104224, `000000032_gompertz` = 0.249995, `000000033_gompertz` = 0.462125, `000000034_gompertz` = 0.396521, `000000035_gompertz` = 0,
`000000036_gompertz` = 0.258785, `000000037_gompertz` = 0.242243, `000000038_gompertz` = 0.347565, `000000039_gompertz` = 0.294371, `000000040_gompertz` = 1.14334, `000000041_gompertz` = 0.135071, `000000042_gompertz` = 0.119921, `000000043_gompertz` = 0.313962, `000000044_gompertz` = 0.0979543, `000000045_gompertz` = 0.135268, `000000046_gompertz` = 0.260895, `000000047_gompertz` = 0.507332, `000000049_gompertz` = 1.83762, `000000050_gompertz` = 0.183626, `000000051_gompertz` = 0.119591, `000000052_gompertz` = 0.166217,
`000000053_gompertz` = 0.375883, `000000054_gompertz` = 0.159972, `000000055_gompertz` = 0.378644, `000000056_gompertz` = 0.198184, `000000057_gompertz` = 0.854106, `000000058_gompertz` = 0.113661, `000000059_gompertz` = 0.0460331, `000000060_gompertz` = 0.261158, `000000061_gompertz` = 0.349721, `000000062_gompertz` = 0.155654, `000000063_gompertz` = 0.257054, `000000065_gompertz` = 0.862269, `000000066_gompertz` = 0.252522, `000000067_gompertz` = 1.27307, `000000068_gompertz` = 0.306418, `000000069_gompertz` = 0.102574,
`000000071_gompertz` = 0.882302, `000000072_gompertz` = 0.738851, `000000074_gompertz` = 0.290652, `000000075_gompertz` = 0.427994, `000000076_gompertz` = 0.325665, `000000077_gompertz` = 0.260397, `000000078_gompertz` = 0.331447, `000000079_gompertz` = 1.05246, `000000080_gompertz` = 0.616053, `000000081_gompertz` = 0.183084, `000000082_gompertz` = 0.18414, `000000083_gompertz` = 0.141403, `000000084_gompertz` = 0.324513, `000000085_gompertz` = 0.366182, `000000086_gompertz` = 0.671934, `000000087_gompertz` = 0.274896,
`000000088_gompertz` = 0.283223, `000000089_gompertz` = 0.252231, `000000090_gompertz` = 0.24439, `000000091_gompertz` = 0.109753, `000000092_gompertz` = 0.192221, `000000093_gompertz` = 0.15623, `000000094_gompertz` = 0.392484, `000000095_gompertz` = 0.171969, `000000096_gompertz` = 0.217711, `000000097_gompertz` = 0.54861, `000000098_gompertz` = 0.431443, `000000100_gompertz` = 0.298392)"
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/hc-burrlioz/hc_boron.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
dist,percent,est,se,lcl,ucl,wt,method,nboot,pboot,samples
invpareto,5,0.386944,0.347873,0.195882,1.10643,1,non-parametric,10,1,"c(`1` = 0.982745, `2` = 0.93683, `3` = 0.178607, `4` = 0.292255, `5` = 0.410782, `6` = 0.342529, `7` = 0.255384, `8` = 1.14234, `9` = 0.339202, `10` = 0.476697)"
invpareto,5,0.386944,0.347873,0.195882,1.10643,1,non-parametric,10,1,"c(`000000001_invpareto` = 0.982745, `000000002_invpareto` = 0.93683, `000000003_invpareto` = 0.178607, `000000004_invpareto` = 0.292255, `000000005_invpareto` = 0.410782, `000000006_invpareto` = 0.342529, `000000007_invpareto` = 0.255384, `000000008_invpareto` = 1.14234, `000000009_invpareto` = 0.339202, `000000010_invpareto` = 0.476697)"
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/hc-burrlioz/hc_boron0.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
dist,percent,est,se,lcl,ucl,wt,method,nboot,pboot,samples
invpareto,5,0.386944,0.347873,0.195882,1.10643,1,non-parametric,10,1,"c(`1` = 0.982745, `2` = 0.93683, `3` = 0.178607, `4` = 0.292255, `5` = 0.410782, `6` = 0.342529, `7` = 0.255384, `8` = 1.14234, `9` = 0.339202, `10` = 0.476697)"
invpareto,5,0.386944,0.347873,0.195882,1.10643,1,non-parametric,10,1,"c(`000000001_invpareto` = 0.982745, `000000002_invpareto` = 0.93683, `000000003_invpareto` = 0.178607, `000000004_invpareto` = 0.292255, `000000005_invpareto` = 0.410782, `000000006_invpareto` = 0.342529, `000000007_invpareto` = 0.255384, `000000008_invpareto` = 1.14234, `000000009_invpareto` = 0.339202, `000000010_invpareto` = 0.476697)"
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/hc-burrlioz/hc_burrIII3.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
dist,percent,est,se,lcl,ucl,wt,method,nboot,pboot,samples
burrIII3,5,0.0180122,0.0330222,0.00257335,0.0960996,1,non-parametric,10,1,"c(`1` = 0.00216345, `2` = 0.0135629, `3` = 0.0249016, `4` = 0.00398519, `5` = 0.00525064, `6` = 0.0456991, `7` = 0.0174388, `8` = 0.0371055, `9` = 0.00563071, `10` = 0.110732)"
burrIII3,5,0.0180122,0.0330222,0.00257335,0.0960996,1,non-parametric,10,1,"c(`000000001_burrIII3` = 0.00216345, `000000002_burrIII3` = 0.0135629, `000000003_burrIII3` = 0.0249016, `000000004_burrIII3` = 0.00398519, `000000005_burrIII3` = 0.00525064, `000000006_burrIII3` = 0.0456991, `000000007_burrIII3` = 0.0174388, `000000008_burrIII3` = 0.0371055, `000000009_burrIII3` = 0.00563071, `000000010_burrIII3` = 0.110732)"
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
dist,percent,est,se,lcl,ucl,wt,method,nboot,pboot,samples
burrIII3,5,0.0180122,0.0149874,0.00621681,0.0503455,1,parametric,10,1,"c(`1` = 0.024927, `2` = 0.0532566, `3` = 0.0161967, `4` = 0.0403185, `5` = 0.0122971, `6` = 0.0185225, `7` = 0.0113264, `8` = 0.00490145, `9` = 0.0107475, `10` = 0.0155147)"
burrIII3,5,0.0180122,0.0149874,0.00621681,0.0503455,1,parametric,10,1,"c(`000000001_burrIII3` = 0.024927, `000000002_burrIII3` = 0.0532566, `000000003_burrIII3` = 0.0161967, `000000004_burrIII3` = 0.0403185, `000000005_burrIII3` = 0.0122971, `000000006_burrIII3` = 0.0185225, `000000007_burrIII3` = 0.0113264, `000000008_burrIII3` = 0.00490145, `000000009_burrIII3` = 0.0107475, `000000010_burrIII3` = 0.0155147)"
12 changes: 6 additions & 6 deletions tests/testthat/_snaps/hc/hc.csv
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
dist,percent,est,se,lcl,ucl,wt,method,nboot,pboot,samples
gamma,5,1.07428,0.983875,0.709111,3.19472,0.356574,parametric,10,1,"c(`1` = 0.987785, `2` = 3.15112, `3` = 0.84656, `4` = 0.70604, `5` = 1.98672, `6` = 0.873452, `7` = 1.18798, `8` = 0.836688, `9` = 0.719689, `10` = 3.20738)"
lgumbel,5,1.76939,0.401763,1.39032,2.63032,0.0134466,parametric,10,1,"c(`1` = 2.2833, `2` = 1.48094, `3` = 2.12922, `4` = 2.36856, `5` = 1.81154, `6` = 1.96535, `7` = 1.36401, `8` = 1.93797, `9` = 2.70632, `10` = 2.09232)"
llogis,5,1.56226,0.834776,0.851639,3.37274,0.0656452,parametric,10,1,"c(`1` = 0.751505, `2` = 3.04268, `3` = 2.10953, `4` = 2.22634, `5` = 1.30249, `6` = 2.52802, `7` = 3.46857, `8` = 2.04533, `9` = 1.85618, `10` = 1.19654)"
lnorm,5,1.68117,0.823601,0.8894,3.02109,0.177236,parametric,10,1,"c(`1` = 3.09183, `2` = 2.42899, `3` = 1.325, `4` = 1.61081, `5` = 2.60329, `6` = 0.865973, `7` = 2.77742, `8` = 1.19715, `9` = 2.45546, `10` = 0.970094)"
lnorm_lnorm,5,1.54141,0.329119,0.952154,1.82195,0.0296268,parametric,10,1,"c(`1` = 1.64166, `2` = 1.67909, `3` = 1.80876, `4` = 0.921821, `5` = 1.68365, `6` = 1.28523, `7` = 1.82578, `8` = 1.05663, `9` = 1.20995, `10` = 1.67578)"
weibull,5,1.08673,0.895134,0.819219,3.40858,0.357472,parametric,10,1,"c(`1` = 1.67077, `2` = 0.93999, `3` = 1.45323, `4` = 3.60435, `5` = 1.0464, `6` = 1.48364, `7` = 2.08463, `8` = 1.05416, `9` = 2.73428, `10` = 0.784157)"
gamma,5,1.07428,0.983875,0.709111,3.19472,0.356574,parametric,10,1,"c(`000000001_gamma` = 0.987785, `000000002_gamma` = 3.15112, `000000003_gamma` = 0.84656, `000000004_gamma` = 0.70604, `000000005_gamma` = 1.98672, `000000006_gamma` = 0.873452, `000000007_gamma` = 1.18798, `000000008_gamma` = 0.836688, `000000009_gamma` = 0.719689, `000000010_gamma` = 3.20738)"
lgumbel,5,1.76939,0.401763,1.39032,2.63032,0.0134466,parametric,10,1,"c(`000000001_lgumbel` = 2.2833, `000000002_lgumbel` = 1.48094, `000000003_lgumbel` = 2.12922, `000000004_lgumbel` = 2.36856, `000000005_lgumbel` = 1.81154, `000000006_lgumbel` = 1.96535, `000000007_lgumbel` = 1.36401, `000000008_lgumbel` = 1.93797, `000000009_lgumbel` = 2.70632, `000000010_lgumbel` = 2.09232)"
llogis,5,1.56226,0.834776,0.851639,3.37274,0.0656452,parametric,10,1,"c(`000000001_llogis` = 0.751505, `000000002_llogis` = 3.04268, `000000003_llogis` = 2.10953, `000000004_llogis` = 2.22634, `000000005_llogis` = 1.30249, `000000006_llogis` = 2.52802, `000000007_llogis` = 3.46857, `000000008_llogis` = 2.04533, `000000009_llogis` = 1.85618, `000000010_llogis` = 1.19654)"
lnorm,5,1.68117,0.823601,0.8894,3.02109,0.177236,parametric,10,1,"c(`000000001_lnorm` = 3.09183, `000000002_lnorm` = 2.42899, `000000003_lnorm` = 1.325, `000000004_lnorm` = 1.61081, `000000005_lnorm` = 2.60329, `000000006_lnorm` = 0.865973, `000000007_lnorm` = 2.77742, `000000008_lnorm` = 1.19715, `000000009_lnorm` = 2.45546, `000000010_lnorm` = 0.970094)"
lnorm_lnorm,5,1.54141,0.329119,0.952154,1.82195,0.0296268,parametric,10,1,"c(`000000001_lnorm_lnorm` = 1.64166, `000000002_lnorm_lnorm` = 1.67909, `000000003_lnorm_lnorm` = 1.80876, `000000004_lnorm_lnorm` = 0.921821, `000000005_lnorm_lnorm` = 1.68365, `000000006_lnorm_lnorm` = 1.28523, `000000007_lnorm_lnorm` = 1.82578, `000000008_lnorm_lnorm` = 1.05663, `000000009_lnorm_lnorm` = 1.20995, `000000010_lnorm_lnorm` = 1.67578)"
weibull,5,1.08673,0.895134,0.819219,3.40858,0.357472,parametric,10,1,"c(`000000001_weibull` = 1.67077, `000000002_weibull` = 0.93999, `000000003_weibull` = 1.45323, `000000004_weibull` = 3.60435, `000000005_weibull` = 1.0464, `000000006_weibull` = 1.48364, `000000007_weibull` = 2.08463, `000000008_weibull` = 1.05416, `000000009_weibull` = 2.73428, `000000010_weibull` = 0.784157)"
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/hc/hc_1.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
dist,percent,est,se,lcl,ucl,wt,method,nboot,pboot,samples
average,5,1.68117,NA,0.934605,0.934605,1,parametric,1,1,c(`1` = 0.934605)
average,5,1.68117,NA,0.934605,0.934605,1,parametric,1,1,c(`000000001_lnorm` = 0.934605)
Loading

0 comments on commit 13d6362

Please sign in to comment.