Applies a k-fold approach to re-sample estimates from PlackettLuce model. The function will subset the data into 'k' number folds and re-calculate the model estimates. Optionally, a Bayesian bootstrapping technique can be used to increase output size and normalize the distribution of estimates
resample(object, k = 5, bootstrap = FALSE, seed = NULL, ...)a PlackettLuce model object
an integer for the number of bins to subset the data
logical, to run a Bayesian bootstrapping on object
integer, the seed for random number generation. If NULL (the default), gosset will set the seed randomly
additional arguments passed to methods, see details
A data frame with re-sampled estimates
Additional details for Bayesian bootstrapping:
statistic A function that accepts data as its first argument and possibly,
the weights as its second, if use_weights is TRUE; n1 The size of
the bootstrap sample; n2 The sample size used to calculate
the statistic each bootstrap draw
library("PlackettLuce")
data("breadwheat", package = "gosset")
G = rank_tricot(breadwheat,
items = c("variety_a","variety_b","variety_c"),
input = c("overall_best","overall_worst"),
group = FALSE)
mod = PlackettLuce(G)
# default method, no bootstrapping and 5 folds
resample(mod)
#> item estimate
#> <chr> <dbl>
#> 1: CSW18 0.0000
#> 2: WR544 -3.0966
#> 3: PBW343 -0.5365
#> 4: HP1633 -3.3190
#> 5: HW2045 -3.0195
#> ---
#> 76: K0307 -2.9475
#> 77: HI1563 -2.9003
#> 78: PBW502 -2.6861
#> 79: HD2932 -2.2437
#> 80: K9107 0.5710
resample(mod, log = FALSE)
#> item estimate
#> <chr> <dbl>
#> 1: CSW18 0.1700
#> 2: WR544 0.0128
#> 3: PBW343 0.1965
#> 4: HP1633 0.0117
#> 5: HW2045 0.0128
#> ---
#> 76: K0307 0.0105
#> 77: HI1563 0.0110
#> 78: PBW502 0.0146
#> 79: HD2932 0.0207
#> 80: K9107 0.3113
# the argument 'seed' will make sure that the function
# always return the same results
resample(mod, log = FALSE, seed = 1526)
#> item estimate
#> <chr> <dbl>
#> 1: CSW18 0.1713
#> 2: WR544 0.0122
#> 3: PBW343 0.1513
#> 4: HP1633 0.0137
#> 5: HW2045 0.0114
#> ---
#> 76: K0307 0.0121
#> 77: HI1563 0.0138
#> 78: PBW502 0.0179
#> 79: HD2932 0.0256
#> 80: K9107 0.3650
# add bootstrapping
resample(mod, bootstrap = TRUE, log = FALSE, n1 = 100)
#> item estimate
#> <chr> <dbl>
#> 1: CSW18 0.2041
#> 2: CSW18 0.2012
#> 3: CSW18 0.2029
#> 4: CSW18 0.2049
#> 5: CSW18 0.2055
#> ---
#> 1596: WR544 0.0120
#> 1597: WR544 0.0124
#> 1598: WR544 0.0123
#> 1599: WR544 0.0120
#> 1600: WR544 0.0122