I want to use Lasso or ridge regression for a model with more than 50,000 variables. I want do so using software package in R. How can I estimate shrinkage parameter ($\lambda$)? Excuse me for the simple question as I new to the field...
Here is upto the point I got to:
set.seed (123) Y <- runif (1000) Xv <- sample(c(1,0), size= 1000*1000, replace = T) X <- matrix(Xv, nrow = 1000, ncol = 1000) mydf <- data.frame(Y, X) require(MASS) lm.ridge(Y ~ ., mydf) plot(lm.ridge(Y ~ ., mydf, lambda = seq(0,0.1,0.001)))
My question is how do I know which $\lambda$ is best for my model ???