Help using Base SAS procedures

LASSO in Logistic regression

Reply
Occasional Contributor
Posts: 9

LASSO in Logistic regression

Hi,

I was just wondering if there is any way to use LASSO & ELASTIC NET in logistic regression model using SAS.

Any help or suggestions will be much appreciated.

Lovedeep

Respected Advisor
Posts: 2,655

Re: LASSO in Logistic regression

Look into PROC GLMSELECT.  You may need to transform your dependent variable onto the logit scale before fitting.

Steve Denham

Occasional Contributor
Posts: 9

Re: LASSO in Logistic regression

Thanks Steve,

But can you please guide me for the best way to accomplish it.

Thanks

Respected Advisor
Posts: 2,655

Re: LASSO in Logistic regression

Get your data into the events/trials syntax, if it is not already.  Apply a logit transform to the dependent variable, and run GLMSELECT with the LASSO option.

Steve Denham

Frequent Contributor
Posts: 81

Re: LASSO in Logistic regression

Lasso variable selection is available for logistic regression in the latest version of the HPGENSELECT procedure (SAS/STAT 13.1 included in Base SAS 9.4).

Elastic net isn't supported quite yet. However if you're interested I can send you my Base SAS coding solution for lasso + elastic net for logistic and Poisson regression which I just presented at the 2015 SAS Global Forum.

Frequent Contributor
Posts: 102

Re: LASSO in Logistic regression

Found it.  Thanks!  I will give it a try.

http://support.sas.com/resources/papers/proceedings15/3297-2015.pdf

Google also found another suggestion for use of GLMSELECT.  Code dichotomous outcome as +-1, run GLMSELECT and apply cutoff > 0.  Will give that a try as well.

Thanks,

Haris

Frequent Contributor
Posts: 81

Re: LASSO in Logistic regression

You're welcome, let me know if you have questions about the program.

The code will generate & output logistic regression coefficient estimates for selected values of the alpha & lambda parameters, but I haven't yet written code that selects the optimal alpha & lambda values for the elastic net model. You could do this using 5 or 10-fold cross validation, or else randomly split your data into two chunks, training and validation. Fit the elastic net  models for varying alpha & lambda values with the training data, then score the validation dataset with the output model coefficients & compare predictive accuracy.

I haven't tried the GLMSELECT shortcut using +1/-1 but would be interested to see how it performs.

Robert

N/A
Posts: 1

Re: LASSO in Logistic regression

Hello Robert,

I also need to use LASSO in logistic regression model in SAS and my SAS version doesn't have HPGENSELECT procedure. Could you mind sending me the link of your Base SAS coding solution for lasso for logistic and Poisson regression  presented at the 2015 SAS Global Forum?

Thank you very much and I appreciate your help!

Fiona

Ask a Question
Discussion stats
  • 7 replies
  • 4042 views
  • 1 like
  • 5 in conversation