CDLasso-package {CDLasso} | R Documentation |
Greedy coordinate descent for L1 regression and cyclic coordinate descent for L2 regression with p predictors and n cases
Package: | CDLasso |
Title: | Coordinate Descent for L1 and L2 Regression |
Version: | 1.1 |
Date: | 2013-13-03 |
Author: | Edward Grant, Kenneth Lange, Tong Tong Wu |
Maintainer: | Edward Grant <edward.m.grant@gmail.com> |
Description: | Coordinate Descent for L1, L2, and Logistic Regression |
License: | GPL-2 |
Edward Grant, Kenneth Lange, Tong Tong Wu
Maintainer: Edward Grant edward.m.grant@gmail.com
Wu, T.T. and Lange, K. (2008). Coordinate Descent Algorithms for Lasso Penalized Regression. Annals of Applied Statistics, Volume 2, No 1, 224-244.
set.seed(1001) 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 logity=exp(y)/(1+exp(y)) ylog=rbinom(n=length(logity),prob=logity,size=1) rownames(x)<-1:nrow(x) colnames(x)<-1:ncol(x) #L1 outL1<-l1.reg(x,y,lambda=50) outL1est<-l1.reg(x[outL1$selected,],y,lambda=0) #L2 outL2<-l2.reg(x,y,2) outL2est<-l2.reg(x[outL2$selected,],y,lambda=0) #Logistic outLOGIT<-logit.reg(x,ylog,lambda=50) outLOGITest<-logit.reg(x[outLOGIT$selected,],ylog,lambda=0)