How do I find the adjusted $R^2$ (or $r^2$) from Lasso and Ridge regression?
I used the glmnet package. For instance if I have this code so far....
###LASSO
library(glmnet)
attach(mtcars)
y=mtcars$mpg
model=model.matrix(mpg~ . data=mtcars)
lasso.reg=cv.glmnet(model, y, type.measure='mse', alpha=0)
names(lasso.reg)
mse=lasso.reg$cvm[lasso.reg$lambda == lasso.reg$lambda.min]
rmse = sqrt(mse)
Can someone show me the code that will give me the $R^2$ and the Adjusted $R^2$. Sorry I'm missing something obvious.