plot.cvError {crisp}R Documentation

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

## S3 method for class 'cvError'
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

## 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)

[Package crisp version 1.0.0 Index]