animation (version 2.6)

cv.ani: Demonstration for the process of cross-validation

Description

This function uses rectangles to illustrate the \(k\) folds and mark the test set and the training set with different colors.

Usage

cv.ani(x = runif(150), k = 10, col = c("green", "red", "blue"), pch = c(4, 1), ...)

Arguments

x

a numerical vector which stands for the sample points.

k

an integer: how many parts should we split the data into? (comes from the \(k\)-fold cross-validation.)

col

a character vector of length 3 specifying the colors of: the rectangle representing the test set, the points of the test set, and points of the training set.

pch

a numeric vector of length 2 specifying the symbols of the test set and training set respectively.

other arguments passed to plot.default

Value

None (invisible NULL).

Details

Briefly speaking, the process of cross-validation is just to split the whole data set into several parts and select one part as the test set and the rest parts as the training set.

The computation of sample sizes is base on kfcv.

References

Examples at https://yihui.name/animation/example/cv-ani/

See Also

kfcv