Takes a random sample of size N-p
from the population.
See the Details section below for further information.
Arguments
- N
positive integer value, the population size
- p
integer, the number of elements to holdout
- prob
(optional) N-length vector of positive numeric values, the probability weights for obtaining the
N
elements
Details
A random sample of size p
is taken from the population and used
as holdout data.
This function returns a sample of size N-p
obtained by removing the holdout
sample from the population.
Examples
#Set seed for reproducibility
set.seed(seed = 5381L)
#Take one sample leaving out p elements
leavePOutSample(N = 5, p = 2)
#> [1] 2 3 4
#Equivalent to leave-one-out
leavePOutSample(N = 5, p = 1)
#> [1] 1 3 4 5