Hi RobF,
I like to see your Logistic regression lasso SAS code as you mentioned.
Thanks!
_kamal
Hi Kamal,
I just sent the code to your gmail account - let me know if you have any problems opening the file.
Rob
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.
Harris,
If you have SAS Enterprise Miner, you can obtain the LASSO fit for binary target by using the LARS node.
Funda
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.
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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.