# How to obtain Confidence Intervals for a LASSO regression?

I'm very new from R. I have this code for a LASSO regression:

X <- X <- as.matrix(read.csv2("DB_LASSO_ERP.csv"))
y <- read.csv2("OUTCOME_LASSO_ERP.csv",header=F)$$V1 fit <- glmnet(x = X, y = y, family = "binomial", alpha = 1) crossval <- cv.glmnet(x = X, y = y, family = "binomial") penalty <- crossval$$lambda.min
fit1 <- glmnet(x = X, y = y, family = "binomial", alpha = 1, lambda = penalty)


I want to obtain Confidence Intervals for this coefficients. How can I do? Can you help me with the script please? I have very few experience with R. Thanks!

• The answer here suggests that there is no consensus on how to calculate the standard errors of LASSO. Since you need the standard errors for confidence interval, you have to be very careful – V. Aslanyan Apr 10 '19 at 16:31
• The link provided by @V.Aslanyan is quite useful, but note that the initial discussion on that page (from 2014) pre-dated much subsequent work on this topic. – EdM Apr 10 '19 at 16:55

The predictors chosen by LASSO (as for any feature-selection method) can be highly dependent on the data sample at hand. You can examine this in your own data by repeating your LASSO model-building procedure on multiple bootstrap samples of the data. If you have predictors that are correlated with each other, the specific predictors chosen by LASSO are likely to differ among models based on the different bootstrap samples. So what do you mean by a confidence interval for a coefficient for a predictor, say predictor $$x_1$$, if $$x_1$$ wouldn't even have been chosen by LASSO if you had worked with a different sample from the same population?