Usage
## S3 method for class 'factor':
cv(y, formula, data, model, predict, k=10, random=TRUE, strat=TRUE,
predictions=FALSE, \dots)
Arguments
y
response variable, either of class factor
(classification), numeric
(regression) or Surv
(survival).
data
data frame of predictors and response described in formula
.
model
a function implementing the predictive model to be
evaluated. The function model
can either return an
object representing a fitted model or a function with
argument newdata
which returns predicted va
predict
a function with arguments object
and newdata
only which predicts the status of the observations in newdata
based
on the fitted model in object
.
k
k-fold cross-validation.
random
logical, indicates whether a random order or the given
order of the data should be used for sample splitting or not.
strat
logical, stratified sampling or not.
predictions
logical, return the prediction of each observation.
...
additional arguments to model
.