BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
koomalkc
Fluorite | Level 6

Hi RobF,

I like to see your Logistic regression lasso SAS code as you mentioned.

 

Thanks!

 

_kamal

koomalkc@gmail.com

RobertF
Obsidian | Level 7

Hi Kamal,

 

I just sent the code to your gmail account - let me know if you have any problems opening the file.

 

Rob

Salomon
Calcite | Level 5
Hi Robert,
Sorry I did not get the email with the code . Could you please send it again?
Thanks a lot ,
Komla
RobertF
Obsidian | Level 7

Yes - koomalkc@gmail.com is your gmail account, is that correct?

 

Also, I attached a copy of my SAS code in my response to Salomon below.

Salomon
Calcite | Level 5
Ooh no! My email is kahlijah@gmail.com..
Thank you !
Salomon
Calcite | Level 5
Ooh no! My email is kahlijah@gmail.com..
Thank you !
koomalkc
Fluorite | Level 6
Thanks a lot! I appreciated for this.
koomalkc
Fluorite | Level 6
Thanks a lot! I appreciated for this.
Funda_SAS
SAS Employee

Harris,

If you have SAS Enterprise Miner, you can obtain the LASSO fit for binary target by using the LARS node.

Funda

Salomon
Calcite | Level 5
Hello RobF. I'm having the same issue . Could you please send me the link to your short program that runs a logistic regression using LASSO in Base SAS 9.3. It will be greatly appreciated . Thanks ..
Salomon
Calcite | Level 5
Hello @RobF. I'm having the same issue . Could you please send me the link to your short program that runs a logistic regression using LASSO in Base SAS 9.3. It will be greatly appreciated . Thanks
RobF
Quartz | Level 8

Hi Salomon,

 

Here's the code for both the logistic regression and Poisson regression tested on the Diabetes dataset (available at http://www4.stat.ncsu.edu/~boos/var.select/diabetes.tab.txt).

 

Either ridge regression (alpha=0), lasso (alpha=1), or elastic net (0 < alpha < 1) may be run by inputing alpha and lambda parameters.

 

Please note that my code isn't quite complete: in order to decide on an optimal lambda value for the lasso, the standard approach is to use cross-validation to minimize prediciton errors across a range of specified lambda values. To do this, split your analysis dataset into k CV folds (typically k=5 or k=10). Run the program (including the standardization and parameter initialization code) on each of the k training datasets. Then score the validation datasets with coefficients generated from each run. Select the value of lambda with the lowest average prediction error. Another option is the “one-standard-error” rule: select the largest lambda value that is still within 1 stnd error of the lambda value with the minimal prediction error.

 

 

StatDave
SAS Super FREQ

This note discusses shrinkage methods available in SAS including LASSO, ridging, and elastic net.  The note provides a link to a paper by Gunes (2015) which discusses LASSO and elastic net and illustrates these methods using PROC GLMSELECT.  In addition, the note shows how LASSO (L1 regularization), ridging (L2 regularization), and elastic net (combination of L1 and L2 regularization) can be directly implemented in PROC NLMIXED which allows you to have direct control over the penalties that these methods add to the likelihood function. Several examples using NLMIXED are provided as well as an example of using LASSO in PROC HPGENSELECT to fit a logistic model.

 

See this note for quick pointers to procedures implementing any of these methods as well as LAR and many other statistics and methods. 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 27 replies
  • 10722 views
  • 15 likes
  • 11 in conversation