Contents
- 1 When to use a grouped lasso in Lasso regression?
- 2 How to use lasso in are with categorical variables?
- 3 Is the LASSO method for variable selection in the Cox model?
- 4 What is the penalty for modified group lasso?
- 5 Is the likelihood ratio test significant for Lasso?
- 6 How to create a categorical variable in regression?
When to use a grouped lasso in Lasso regression?
1 Answer 1. When dealing with categorical variables in LASSO regression, it is usual to use a grouped LASSO that keeps the dummy variables corresponding to a particular categorical variable together (i.e., you cannot exclude only some of the dummy variables from the model).
How to use lasso in are with categorical variables?
I’ve got a dataset with 1000 observations and 76 variables, about twenty of which are categorical. I want to use LASSO on this entire data set.
How is feature selection with dummy coding of categorical variable?
Selection methods such as elastic nets or lasso regression select the best predictors, whereby it is possible that only some dummies of each categorical variable are selected. I am wondering, if there can appear some problems due to this procedure.
How to make a dummy variable in Lasso?
You can play around with values for lambda (a tuning parameter) or just leave the option blank and the function will pick a range for you. You can make dummy variables from your factor using model.matrix. I create a data.frame. y is the target variable.
Is the LASSO method for variable selection in the Cox model?
According Tibshirani ( THE LASSO METHOD FOR VARIABLE SELECTION IN THE COX MODEL, Statistics in Medicine, VOL. 16, 385-395 (1997) ), who literally wrote the book on regularization methods, you should standardize the dummies. However, you then lose the straightforward interpretability of your coefficients.
What is the penalty for modified group lasso?
A useful method is the Modified Group LASSO (MGL) described in Choi, Park and Seo (2012). In this method the penalty is proportional to the norm of the β vector for the set of dummy variables.
Which is the most used software for Lasso?
One of the most used softwares for lasso (and friends) is R’s glmnet. From the help page, printed by ?glmnet: standardize: Logical flag for x variable standardization, prior to fitting the model sequence. The coefficients are always returned on the original scale.
Is it okay to use lasso for prediction?
If all you care about is prediction, then this is probably fine, and the approach provided by Flo.P should be okay. LASSO will find you a useful set of variables, and you probably won’t be over-fit. However, if you’re interested in interpreting your model or discussing which factors are important after the fact, you’re in a weird spot.
Is the likelihood ratio test significant for Lasso?
Depending on your seed, the likelihood ratio test may or may not be significant and the 6 separate Wald tests may or may not be significant. The problem with the 6 separate Wald tests is multiple testing is applied. This relates to LASSO because with factors we do not hypothesize that separate levels may be predictive.
How to create a categorical variable in regression?
In Method 2, we use a “do-loop” to generate the new variables, which can be useful if your categorical variable has a large number of levels. * Method 1 for creating dummy variables. compute x1 = 0. if race = 1 x1 = 1. compute x2 = 0. if race = 2 x2 = 1. compute x3 = 0. if race = 3 x3 = 1. execute. * Method 2 for creating dummy variables.
Can a categorical predictor variable be coded 0 / 1?
A categorical predictor variable does not have to be coded 0/1 to be used in a regression model. It is easier to understand and interpret the results from a model with dummy variables, but the results from a variable coded 1/2 yield essentially the same results.