BookmarkSubscribeRSS Feed
Anu_R
Calcite | Level 5
I am trying to perform logistic regression with Lasso. For the logistic regression part I am using PROC LOGISTIC but I am not sure how to do Lasso with it. I searched online an and found that PROC GLMSELECT allows us to do lasso. But I am not sure how to do a Lasso on Logistic Regression.
1 REPLY 1
yonggang
SAS Employee

PROC GLMSELECT cannot perform logistic regression with LASSO.  You may try PROC QUANTSELECT to perform Support Vector Machine (SVM) classification with LASSO penalty. An example is as follows:

/* Start: data simulation */
%let seed=111;
Data raw;
     array x[10];
     do i=1 to 1000;
          x0=1; /* regressor for estimating bias parameter */
          do j=1 to 10;
              x = rannor(&seed);
          end;
          y = 2*((3*x1+2*x2+x3+1+0.1*rannor(&seed))>0)-1; /*So the true model is proportional to (bias=1, x1=3, x2=2, x1=1).*/
          output;
     end;
run;
/* End: data simulation */

/* TransformSVM2QR macro pre-processes raw data for using QUANTSELECT.*/
%macro TransformSVM2QR(raw);
data transferred_&raw;
   set &raw;
   %do j=1 %to 10;
       x&j = y*x&j;
   %end;
   bias=y;
   y=1;
   run;
%mend TransformSVM2QR;

%TransformSVM2QR(raw);

ods graphics on;


proc quantselect data=transferred_raw plot=all;
   model y= bias x1-x10/quantile=1 noint selection=lasso(choose=validate include=1 sh=3);
   partition fraction(validate=0.2);
run;

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 1605 views
  • 0 likes
  • 2 in conversation