relaxo: Relaxed Lasso (relaxo)

Description Usage Arguments Value Author(s) References See Also Examples

Description

Computes all "Relaxed Lasso" solutions.

Usage

1
relaxo(X, Y, phi = seq(0, 1, length = 4), max.steps = min(2*length(Y), 2 * ncol(X)), fast = TRUE,  keep.data = TRUE, warn=TRUE)

Arguments

X

n x p-dimensional matrix or data frame containing the predictor variables; columns are supposed to be scaled and centered.

Y

n-dimensional numerical response vector; supposed to be centered to mean 0.

phi

Relaxation parameter in [0,1]. A value of phi=1 corresponds to the regular Lasso solutions; a value of phi=0 computes the OLS estimates on the set of variables selected by the Lasso.

max.steps

Maximal number of steps the LARS algorithm is run.

fast

Should the estimates be computed in approx. the same time as the LARS algorithm? If fast=TRUE, minor deviations from the original Relaxed Lasso solution can occur.

keep.data

Should the data be kept for later usage e.g. (when computing predicted values for the training data) ?

warn

If TRUE, warnings are given if the predictor variables X are not centered and scaled or if the reponse variable is not centered) ?

Value

An object of class relaxo, for which plot and predict methods are available.

Author(s)

Nicolai Meinshausen nicolai@stat.berkeley.edu

References

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

See Also

See also cvrelaxo for computation of the cross-validated solution with optimal predictive performance

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
	data(diabetes)

## Center and scale variables
   	x <- scale(diabetes$x)
	y <- as.numeric(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))

relaxo documentation built on May 2, 2019, 12:08 p.m.

Related to relaxo in relaxo...