Displaying 1 result from an estimated 1 matches for "lasso_r".
Did you mean:
lasso
2009 Jun 13
2
How to write loop
...dim(X1)
#[1] 50 49
X2<-X1[2:dim(X1)[1],] # new X2 is constructed
dim(X2)
#[1] 49 49
y<-as.matrix(X1[1,]) # Now first row of the X1 acts a response vector
dim(y)
# [1] 49 1
# application of LASSO regression where y is response and X2 is a design
matrix
data1<-data.frame(y,X2=I(X2))
lasso_res=lassoCV(y~X2,data=data1,K=10,fraction=seq(0.1,1,by=0.1),use.Gram=FALSE)
# to get optimum value of Cross Validation
lasso_coef=lassocoef(y~X2,data=data1,sopt=lasso_res$sopt,use.Gram=FALSE) #
to get the coefficients
[[alternative HTML version deleted]]