relaxo (version 0.1-2)

cvrelaxo: Cross validation for "Relaxed Lasso"

Description

Compute the "Relaxed Lasso" solution with minimal cross-validated L2-loss.

Usage

cvrelaxo(X, Y, K = 5, phi = seq(0, 1, length = 10), max.steps = min( 2* length(Y), 2 * ncol(X)), fast = TRUE, keep.data = TRUE, warn=TRUE)

Arguments

X
as in function relaxo
Y
as in function relaxo
K
Number of folds. Defaults to 5.
phi
as in function relaxo
max.steps
as in function relaxo
fast
as in function relaxo
keep.data
as in function relaxo
warn
as in function relaxo

Value

An object of class relaxo, for which print and predict methods exist

Details

The plot method is not useful for result of cvrelaxo (as no path of solutions exists).

References

N. Meinshausen, "Relaxed Lasso", Computational Statistics and Data Analysis, to appear. http://www.stat.berkeley.edu/~nicolai

See Also

See also relaxo for computation of the entire solution path

Examples

Run this code
	data(diabetes)

## Center and scale variables
   	x <- scale(diabetes$x)
	y <- scale(diabetes$y)
	
## Compute "Relaxed Lasso" solution and plot results
 	object <- relaxo(x,y)
	plot(object)   
	
## Compute cross-validated solution with optimal 
## predictive performance and print relaxation parameter phi and 
## penalty parameter lambda of the found solution
	cvobject <- cvrelaxo(x,y)
	print(cvobject$phi)
	print(cvobject$lambda)
	
## Compute fitted values and plot them versus actual values     
	fitted.values <- predict(cvobject)
	plot(fitted.values,y)
	abline(c(0,1))

Run the code above in your browser using DataCamp Workspace