Learn R Programming

crisp (version 1.0.0)

plot.cvError: Plots Cross-Validation Curve for crispCV.

Description

This function plots the cross-validation curve for a series of models fit using crispCV. The cross-validation error with +/-1 standard error is plotted for each value of lambda considered in the call to crispCV with a dotted vertical line indicating the chosen lambda.

Usage

"plot"(x, showSE = T, ...)

Arguments

x
An object of class cvError, which results from calling summary on an object of class crispCV.
showSE
A logical value indicating whether the standard error of the curve should be plotted.
...
Additional arguments to be passed, which are ignored in this function.

Value

None.

Examples

Run this code
## Not run: 
# #See ?'crisp-package' for a full example of how to use this package
# 
# #generate data (using a very small 'n' for illustration purposes)
# set.seed(1)
# data <- sim.data(n = 15, scenario = 2)
# 
# #fit model and select lambda using 2-fold cross-validation
# #note: use larger 'n.fold' (e.g., 10) in practice
# crispCV.out <- crispCV(X = data$X, y = data$y, n.fold = 2)
# 
# #plot the cross-validation error
# plot(summary(crispCV.out))
# ## End(Not run)

Run the code above in your browser using DataLab