cv.work: K-fold cross validation

Description Usage Arguments Value Author(s) Examples

Description

Calculate cross-validation error

Usage

1
cv.work(fun, k = 5, data, cost, response = "y", ...)

Arguments

fun

The model function to call on the data

k

The number of folds

data

The data

cost

Cost function for the error:'cost.mse','cost.01'

response

Character vector indicating which column is the response

...

Extra arguments for model function

Value

A single cross-validated error

Author(s)

Xiaoyao Yang

Examples

1
2
3
4
5
set.seed(188)
X <- rnorm(n=100,mean=3,sd=2)
y <- rnorm(100) + X
dat <- data.frame(y=y,X=X)
cv.work(fun=lm,k=5,data=dat,cost=cost.mse,response='y',formula=y~X)

freestats documentation built on May 2, 2019, 1:18 p.m.

Related to cv.work in freestats...