CVerror: k-Fold Cross Validation Error Rate

View source: R/CVerror.R

CVerrorR Documentation

k-Fold Cross Validation Error Rate

Description

Given a logistic regression model (via glm), or an LDA or QDA model, and a number of folds k, the k-Fold CV error rate is calculated.

Usage

CVerror(mod, k = nrow(stats::model.frame(mod)))

Arguments

mod

A logistic regression, LDA, or QDA model

k

Number of folds; by default LOOCV will be returned

Value

The k-fold CV error rate if k is entered, otherwise the LOOCV error rate.

Examples

mtcars$am=as.factor(mtcars$am)
gmod=glm(am~mpg,binomial,mtcars)
CVerror(gmod)

smallstuff documentation built on June 2, 2022, 5:06 p.m.