Skip to contents

Takes repeated samples from the population. See the Details section below for further information.

Usage

repeatedLeaveOneOut(N)

Arguments

N

positive integer value, the population size

Value

A list of length N where each element is a vector containing the indices of the sampled data.

Details

The leave-one-out is a particular case of the leave-p-out, where p = 1. Samples are repeatedly taken from the population until each element in the population is considered as the holdout data. This function returns a list of N samples of size N-1 obtained by removing the holdout samples from the population.

Author

Alessandro Barberis

Examples

#Set seed for reproducibility
set.seed(seed = 5381L)

#Assign data to N folds
repeatedLeaveOneOut(N = 10)
#> [[1]]
#> [1]  2  3  4  5  6  7  8  9 10
#> 
#> [[2]]
#> [1]  1  2  3  5  6  7  8  9 10
#> 
#> [[3]]
#> [1]  1  2  3  4  5  7  8  9 10
#> 
#> [[4]]
#> [1]  1  2  3  4  6  7  8  9 10
#> 
#> [[5]]
#> [1]  1  2  3  4  5  6  7  8 10
#> 
#> [[6]]
#> [1]  1  2  3  4  5  6  8  9 10
#> 
#> [[7]]
#> [1]  1  2  4  5  6  7  8  9 10
#> 
#> [[8]]
#> [1] 1 2 3 4 5 6 7 8 9
#> 
#> [[9]]
#> [1]  1  3  4  5  6  7  8  9 10
#> 
#> [[10]]
#> [1]  1  2  3  4  5  6  7  9 10
#>