# Running Elastic-Net with missing values with glmnet in R

I have a data frame which has lots of variables and I want to use elastic net in order to reduce the dimensionality, but each variable has also NAs present in it (missing values).

What I've done is to calculate decile-bins in each variable (10 or less bins in each variable - depends on the value range) and then transform each variable into a categorical variable where each observation will be replaced with the bin range it belongs to. My question is - I am still left with NAs, only now it is a category.

R's glmnet cannot work with NAs being present in the data frame so I was thinking to replace those NAs by some arbitrary value (e.g., 99). Can I do that? Will it affect the dimension reduction process carried out by Elastic Net?

• How does linear regression reduce dimensionality? – Jakub Bartczuk Jan 14 '18 at 10:46
• Well, this is the lasso part in elastic net – Corel Jan 14 '18 at 11:04
• That's feature selection for a concrete model, not dimensionality reduction. – Jakub Bartczuk Jan 14 '18 at 18:39
• There are several references to methods of regularization in order to perform feature selection which is basically a dimension reduction. I can input the variables I'm left with in a completely different model afterwards. – Corel Jan 14 '18 at 18:46