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)
resample(mod, log = FALSE)
# the argument 'seed' will make sure that the function
# always return the same results
resample(mod, log = FALSE, seed = 1526)
# add bootstrapping
resample(mod, bootstrap = TRUE, log = FALSE, n1 = 100)