I would like to extract the lambda-matrix of a ridge regression. I can plot it, but I cannot extract the values. The wanted matrix should include the lambdas (in rows) and the variables including names (in cols).
library(glmnet)
x1<-rnorm(200,5,4)
x2<-rnorm(200,45,3)
x3<-rnorm(200,-10,4)
y<-80+x2*3+rnorm(200,0,1)
X<-cbind(x1,x2,x3)
l.vec<-10^seq(10,-2,length=100)
my.ridge<-glmnet(x=X,y=y,alpha=0,
lambda=l.vec,
standardize=TRUE)
plot(my.ridge,xvar="lambda")
How can I re-direct the plot-information into a matrix?
Thx&kind regards
Do you mean the coefficient matrix?
coef(my.ridge)