Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

cv

Cross-validated Error Rate Estimators.


Description

Those functions are low-level functions used by errorest and are normally not called by users.

Usage

## S3 method for class 'factor'
cv(y, formula, data, model, predict, k=10, random=TRUE, 
            strat=FALSE,
            predictions=NULL, getmodels=NULL, list.tindx = NULL, ...)

Arguments

y

response variable, either of class factor (classification), numeric (regression) or Surv (survival).

formula

a formula object.

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 values. In this case, the predict argument to errorest is ignored.

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, defaults to TRUE.

strat

logical, stratified sampling or not, defaults to FALSE.

predictions

logical, return the prediction of each observation.

getmodels

logical, return a list of models for each fold.

list.tindx

list of numeric vectors, indicating which observations are included in each cross-validation sample.

...

additional arguments to model.

Details

See errorest.


ipred

Improved Predictors

v0.9-11
GPL (>= 2)
Authors
Andrea Peters [aut], Torsten Hothorn [aut, cre], Brian D. Ripley [ctb], Terry Therneau [ctb], Beth Atkinson [ctb]
Initial release
2021-03-12

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.