powered by
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.
CVerror(mod, k = nrow(stats::model.frame(mod)))
The k-fold CV error rate if k is entered, otherwise the LOOCV error rate.
A logistic regression, LDA, or QDA model
Number of folds; by default LOOCV will be returned
mtcars$am=as.factor(mtcars$am) gmod=glm(am~mpg,binomial,mtcars) CVerror(gmod)
Run the code above in your browser using DataLab