resample(method, y, ..., subset = TRUE)resample.holdout(y = NULL, frac = 0.5, nfold = 5,
balanced = is.factor(y), subset)
resample.crossval(y, nfold = 5, nrep = 5, balanced = is.factor(y), subset)
"holdout"
or
"crossval"
."resample.holdout"
.y
that are to be divided and which
that are not to be part of neither set.
If subset
is a resampling scheme, a list of inner
cross-validation schemes will be returned.TRUE
or a positive integer
codes for training set and FALSE
or 0
codes for test set.
Positive integers > 1 code for multiple copies of an observation in the
training set. NA
codes for neither training nor test set and is
used to exclude observations from the analysis altogether.resample.holdout
or resample.crossval
directly, as
resample
performs additional necessary processing of the scheme.Resampling scheme can be visualized in a human digestible form with the
image
function.
Functions for generating custom resampling schemes should be implemented as
follows and then called by resample("myMethod", ...)
:
resample.myMethod <- function(y, ..., subset)
[object Object],[object Object],[object Object]
The function should return a list of the following elements:
[object Object],[object Object]
emil
, subresample
,
image.resample
, index.fit
resample("holdout", 50, frac=1/3)
resample("holdout", factor(runif(60) >= .5))
y <- factor(runif(60) >= .5)
cv <- resample("crossval", y)
image(cv, main="Cross-validation scheme")
Run the code above in your browser using DataLab