I have a dataset with a lot of missing values and mix of continuous and categorical variables. I want to use something like group lasso to do features selection. Probably the output is binary 0,1 and so grouped lasso logistic regression seems to be the more sensible choice.

My problem is the very large number of missing values. Deleting non complete rows is not an option.

Is there any R implementation that can be used similarly to the lasso and that can handle missing values and categorical variables at the same time?

A possible solution has been proposed here but it does not refer to any R package.


1 Answer 1


Multiple imputation of the missing data provides a way to deal with the missing values; R packages Hmisc and mice provide methods. You could then perform lasso on each of the imputed data sets (which now have no missing data), and determine the predictor variables that are most frequently returned. There should be no problems with having both categorical and continuous variables in your data with any of the R packages for lasso, but be sure to normalize the variables before you apply lasso so that differences in scaling among the variables (and thus scale-dependent differences in regression coefficients) don't lead to erroneous results.

For more details, other suggestions, and references, see the earlier discussion How to handle with missing values in order to prepare data for feature selection with LASSO?.

  • $\begingroup$ I am not very familiar with data imputation. I have some variables that have very few non missing values. Something like 20 available samples over a dataset with 13000 samples. Does data imputation work well also with this kind of variables? This is why I was thinking to perform lasso using only the covariance matrix. From what I know lasso does not work very well with categorical variables and that group lasso is a better approach for this kind of problem but your answer seems to contradict this point. Are you sure that lasso can be used also on categorical data? $\endgroup$
    – Donbeo
    Sep 4, 2014 at 14:51
  • $\begingroup$ If your data meet the necessary assumptions, multiple imputation can work quite well. My use of lasso has been for true/false categories, not multiple-level; for variables with more than 2 categories, group lasso can ensure that all categories of a variable are kept or excluded together, if that is what you want. $\endgroup$
    – EdM
    Sep 4, 2014 at 15:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.