8
$\begingroup$

I am using glmnet for LASSO. My data set contains several continuous variables and one categorical variable (it has four levels). I wondered if I could treat three dummy variables as other continuous variables. Should I use a type of group LASSO approach for the three dummies?

$\endgroup$
4
  • 3
    $\begingroup$ Normally, yes, you keep your factors all together. There's several R packages that can do this, including glmnet. $\endgroup$
    – Glen_b
    Commented Sep 10, 2014 at 0:49
  • $\begingroup$ @Glen_b What are the options in glmnet for running group lasso with categorical variables? I don't see anything about categorical variables at web.stanford.edu/~hastie/glmnet/glmnet_alpha.html or cran.r-project.org/web/packages/glmnet/glmnet.pdf $\endgroup$
    – Adrian
    Commented Feb 22, 2017 at 16:57
  • $\begingroup$ See the type.multinomial argument to glmnet $\endgroup$
    – Glen_b
    Commented Feb 22, 2017 at 22:54
  • $\begingroup$ perhaps leave dummies not penalized (as what you with intercept), unless you have a good reason to put a constraint on them. if so, just add dummies and impute zero penalty weights if you use glmnet implementation. $\endgroup$ Commented Mar 25, 2020 at 23:43

1 Answer 1

1
$\begingroup$

As far as I am aware glmnet doesn't have this feature implemented yet. @Glen_b's suggestion of using type.multinomial is used to group variables across all responses in a multinomial model, but there's no way of grouping independent variables in a model. see

https://cran.r-project.org/web/packages/grplasso/grplasso.pdf

for an alternative.

$\endgroup$

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.