Description Details Author(s) References See Also Examples
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.