Generate an incomplete block A-optional design. The function is optimized for incomplete blocks of three, but it will also work with comparisons of any other number of options. The design strives for approximate A optimality, this means that it is robust to missing observations. It also strives for balance for positions of each option. Options are equally divided between first, second, third, etc. position. The strategy is to create a "pool" of combinations that does not repeat combinations and is A-optimal. Then this pool is ordered to make subsets of consecutive combinations also relatively balanced and A-optimal
randomize(
npackages,
itemnames,
ncomp = 3,
availability = NULL,
props = NULL,
...
)
an integer for the number of incomplete blocks to be generated
a character for the name of items tested in the experiment
an integer for the number of items to be assigned to each incomplete block
optional, a vector with integers indicating the number of plots available for each itemnames
optional, a numeric vector with the desired proportions for each itemnames
additional arguments passed to methods
A dataframe with the randomized design
Bailey and Cameron (2004). Combinations of optimal designs. https://webspace.maths.qmul.ac.uk/l.h.soicher/designtheory.org/library/preprints/optimal.pdf
ncomp = 3
npackages = 20
itemnames = c("apple","banana","grape","mango", "orange")
availability = c(5, 8, 50, 50, 50)
randomize(ncomp = ncomp,
npackages = npackages,
itemnames = itemnames)
#> item_A item_B item_C
#> <chr> <chr> <chr>
#> 1: apple grape orange
#> 2: banana orange mango
#> 3: mango apple banana
#> 4: banana mango grape
#> 5: grape orange apple
#> ---
#> 16: apple mango orange
#> 17: banana orange grape
#> 18: mango apple banana
#> 19: orange grape mango
#> 20: grape banana apple
randomize(ncomp = ncomp,
npackages = npackages,
itemnames = itemnames,
availability = availability)
#> item_A item_B item_C
#> <chr> <chr> <chr>
#> 1: banana grape mango
#> 2: apple banana orange
#> 3: mango orange grape
#> 4: grape mango orange
#> 5: orange grape mango
#> ---
#> 16: orange banana grape
#> 17: banana grape mango
#> 18: mango orange apple
#> 19: orange mango grape
#> 20: grape mango orange
if (FALSE) { # interactive()
# run diagnostics to certify that randomization is balanced
# the number of interactions should have the lower sd as possible
# this verification may not work well when technologies are
# tested in different proportions
design = randomize(ncomp = ncomp,
npackages = npackages,
itemnames = itemnames)
design$best = "A"
design$worst = "C"
# number of times each item is tested in the
# trial design
ntest = table(unlist(design[,c(1:3)]))
ntest
# put into the PlackettLuce structure to check
# number of interactions between items
r = gosset::rank_tricot(design, c(1:3), c(4:5))
bn = gosset::set_binomialfreq(r)
bn$interactions = bn$win1 + bn$win2
bn = bn[,c(1,2,5)]
bn
}