nvec <- seq(0, 10, 1)
Rvec <- seq(0.8, 0.85, 0.01)
cvec <- seq(0, 2, 1)
pi <- pi_MCSim_beta(M = 5000, seed = 10, a = 1, b = 1)
#Get data from all combinations of n, c, R
data_all <- bdata_generator(Cf = 10, Cv = 10, nvec = nvec, G = 10000, Cw = 10, N = 100, Rvec = Rvec, cvec = cvec, pi = pi, par = all(), option = c("all"), thres_CR = 0.05)
head(data_all)
#> n R c CR AP RDT Cost RG Cost RG Cost Expected WS Cost
#> 1 0 0.8 0 0.7948000 1.0000000 10 10000 0.000 500.3654
#> 2 1 0.8 0 0.6300625 0.4996346 20 10000 5003.654 329.4260
#> 3 2 0.8 0 0.5011545 0.3350420 30 10000 6649.580 246.0267
#> 4 3 0.8 0 0.3994328 0.2526127 40 10000 7473.873 196.5127
#> 5 4 0.8 0 0.3189480 0.2029711 50 10000 7970.289 163.8177
#> 6 5 0.8 0 0.2551039 0.1697208 60 10000 8302.792 140.6811
#> WS Failure Probability WS Cost Expected Overall Cost
#> 1 0.5003654 500.36539 510.3654
#> 2 0.3294260 164.59264 5188.2465
#> 3 0.2460267 82.42927 6762.0096
#> 4 0.1965127 49.64160 7563.5146
#> 5 0.1638177 33.25026 8053.5392
#> 6 0.1406811 23.87651 8386.6681
#Get data with optimal test sample size and minimum overall costs from all combinations of c, R
data_optimal <- bdata_generator(Cf = 10, Cv = 10, nvec = nvec, G = 10000, Cw = 10, N = 100, Rvec = Rvec, cvec = cvec, pi = pi, par = all(), option = c("optimal"), thres_CR = 0.05)
head(data_optimal)
#> n R c CR AP RDT Cost RG Cost RG Cost Expected WS Cost
#> 1 13 0.80 0 0.04379640 0.07316579 140 10000 9268.342 67.02070
#> 2 13 0.81 0 0.04952572 0.07316579 140 10000 9268.342 67.02070
#> 3 14 0.82 0 0.04779152 0.06826217 150 10000 9317.378 62.88279
#> 4 15 0.83 0 0.04739077 0.06396965 160 10000 9360.303 59.20539
#> 5 16 0.84 0 0.04933936 0.06018231 170 10000 9398.177 55.91351
#> 6 18 0.85 0 0.04545871 0.05380893 190 10000 9461.911 50.26193
#> WS Failure Probability WS Cost Expected Overall Cost
#> 1 0.06702070 4.903623 9413.246
#> 2 0.06702070 4.903623 9413.246
#> 3 0.06288279 4.292516 9471.671
#> 4 0.05920539 3.787348 9524.091
#> 5 0.05591351 3.365004 9571.542
#> 6 0.05026193 2.704541 9654.615