Learn R Programming

CDLasso (version 1.1)

l1.reg: Greedy Coordinate Descent for L1 regression

Description

Greedy Coordinate Descent for L1 regression with p predictors and n cases

Usage

l1.reg(X, Y, lambda = 1)

Arguments

X
p x n design matrix - Note that the rows of X correspond to predictors and the columns to cases.
Y
Outcome of length n
lambda
Penalization Parameter. To find optimal lambda, use cv.l1.reg.

Value

X
The design matrix.
Y
The outcome variable for cases.
cases
The number of cases
predictors
The number of predictors
lambda
The value of penalization parameter lambda used.
objective
The value of the objective function
residual
A vector of length p listing the residuals
L1
The sum of the residuals
estimate
The estimate of the coefficients
nonzeros
The name of "selected" variables included in the model.
selected
The name of the "selected" variables included in the model.

Details

l1.reg performs a new algorithm for estimating regression coefficients with a lasso penalty. The algorithm is based on greedy coordinate descent and Edgeworth's algorithm for ordinary L1 regression. This L1 algorithm is faster than the cyclic coordinate descent in L2 regression (l2.reg).

References

Wu, T.T. and Lange, K. (2008). Coordinate Descent Algorithms for Lasso Penalized Regression. Annals of Applied Statistics, Volume 2, No 1, 224-244.

See Also

print.l1.reg

summary.l1.reg

cv.l1.reg

plot.cv.l1.reg

l2.reg

Examples

Run this code
set.seed(100)
n=500
p=2000
nz = c(1:5)
true.beta<-rep(0,p)
true.beta[nz] = c(1,1,1,1,1)

x=matrix(rnorm(n*p),p,n)
y = t(x) %*% true.beta

rownames(x)<-1:nrow(x)
colnames(x)<-1:ncol(x)

#Lasso penalized L1 regression
out<-l1.reg(x,y,lambda=50)

#Re-estimate parameters without penalization
out2<-l1.reg(x[out$selected,],y,lambda=0)
out2

Run the code above in your browser using DataLab