Skip to contents

This is the constructor of the resampling class.

Usage

resampling(
  method = c("rswor", "srswor", "stratified_rswor", "balanced_rswor", "permutation",
    "kfolds", "stratified_kfolds", "balanced_kfolds", "leave_p_out", "leave_one_out",
    "rswr", "srswr", "stratified_rswr", "balanced_rswr", "bootstrap"),
  N = integer(),
  removed = integer(),
  samples = list(integer())
)

Arguments

method

character, the id of the used sampling method

N

integer, the population size

removed

integer, the indices of elements removed prior to sampling

samples

list, each element is an integer vector containing the samples

Value

An object of class resampling.

Details

An object of class resampling is a named list with 4 elements:

method

the id of the used sampling method

N

the size of the population from which the samples were taken. Elements in the population have index from 1 to N

removed

(optional) vector of indices of elements removed from the population before taking the samples

samples

list of samples repeatedly taken from the population. Each element of the list is an integer vector containing the indices of the elements sampled from the population

Functions to facilitate access to the data stored in a resampling object are available:

Other useful functions include:

  • print: print a summary of the resampling object

  • plot: plot the samples taken from the population as an heatmap

Author

Alessandro Barberis

Examples

#default
resampling()
#> 
#> 1 samples taken from a population of elements by using random sampling
#> without replacement.
#> 
#>   sampleNumber sample sampleSize holdoutSize
#> 1            1                 0           0
#> 

#resampling object
resampling(
 method = 'rswor',
 N = 10,
 samples = list(c(1,5,7))
)
#> 
#> 1 samples taken from a population of 10 elements by using random
#> sampling without replacement.
#> 
#>   sampleNumber  sample sampleSize holdoutSize
#> 1            1 1, 5, 7          3           7
#>