resample: Re-sample model estimates

View source: R/resample.R

resampleR Documentation

Re-sample model estimates

Description

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

Usage

resample(object, k = 5, bootstrap = FALSE, seed = NULL, ...)

Arguments

object

a PlackettLuce model object

k

an integer for the number of bins to subset the data

bootstrap

logical, to run a Bayesian bootstrapping on object

seed

integer, the seed for random number generation. If NULL (the default), gosset will set the seed randomly

...

additional arguments passed to methods, see details

Details

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

Value

A data frame with re-sampled estimates

Author(s)

Kauê de Sousa

Examples

library("PlackettLuce")
library("gosset")

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)


agrobioinfoservices/gosset documentation built on March 13, 2024, 11:23 a.m.