R: Cross-validation

cv {lava} | R Documentation

## Cross-validation

### Description

Cross-validation

### Usage

    cv(modelList, data, K = 5, rep = 1, perf, seed = NULL, mc.cores = 1,
      ...)

### Arguments

`modelList` | List of fitting functions or models
`data` | data.frame
`K` | Number of folds (default 5)
`rep` | Number of repetitions (default 1)
`perf` | Performance measure (default RMSE)
`seed` | Optional random seed
`mc.cores` | Number of cores used for parallel computations
`...` | Additional arguments parsed to models in modelList and perf

### Details

Generic cross-validation function

### Author(s)

Klaus K. Holst

### Examples

    f0 <- function(data,...) lm(...,data)
    f1 <- function(data,...) lm(Sepal.Length~Species,data)
    f2 <- function(data,...) lm(Sepal.Length~Species+Petal.Length,data)
    x <- cv(list(m0=f0,m1=f1,m2=f2),rep=10, data=iris, formula=Sepal.Length~.)
    x2 <- cv(list(f0(iris),f1(iris),f2(iris)),rep=10, data=iris)

[Package lava version 1.5.1 Index]