Linear Regression Model with PROC GLMSELECT

The question arises " What's special about PROC GLMSELECT? Why not use PROC REG, PROC GLM for building a linear regression model?

  1. PROC GLMSELECT supports categorical variables selection with CLASS statement. Whereas, PROC REG does not support CLASS statement.
  2. PROC GLMSELECT supports BACKWARD, FORWARD, STEPWISE selection techniques. Whereas, PROC GLM does not support these algorithms.
Related Posts : 

  1. Checking Assumptions of Multiple Linear Regression with SAS
  2. Homoscedasticity Simplified with SAS
  3. Scoring Linear Regression Model with SAS
/*******************************************************************/
/**Categorical Variables with CLASS Statement and PARAM option************/
/*******************************************************************/

PROC GLMSELECT data=bhalla.GLMSELECT;
class mealcat / param=ref order=data;
model api00 = yr_rnd  mealcat some_col
/ selection=stepwise select=SL showpvalues stats=all STB;
run;

SELECT= criterion specifies the criterion that PROC GLMSELECT uses to determine the order in which effects enter and/or leave at each step of the specified selection method.
SELECT= SL request the traditional approach where effects enter and leave the model based on the significance level.

/*******************************************************************/
/************** Scoring with SCORE statement  **************************/
/*******************************************************************/

PROC GLMSELECT data=ABCD.elemapi2;
class mealcat / param=ref order=data;
model api00 = yr_rnd  mealcat some_col
 / selection=stepwise select=SL showpvalues stats=all STB;
score data = validation out= pred_val;
run;

/*******************************************************************/
/******* Choosing the Best Linear Regression Model with CHOOSE***********/
/*******************************************************************/

PROC GLMSELECT data=bhalla.GLMSELECT;
class mealcat / param=ref order=data;
model api00 = yr_rnd  mealcat some_col
/ CHOOSE=ADJRSQ showpvalues stats=all STB;
run;
CHOOSE statement allows to choose from the list of models at the steps of the selection process the model that yields the best value of the specified criterion. If the optimal value of the specified criterion occurs for models at more than one step, then the model with the smallest number of parameters is chosen. If you do not specify the CHOOSE= option, then the model selected is the model at the final step in the selection process.

/*******************************************************************/
/* Assumption I : Errors (Residuals) should be normally distributed*/
/*******************************************************************/

PROC GLMSELECT data=bhalla.GLMSELECT;
class mealcat / param=ref order=data;
model api00 = yr_rnd  mealcat some_col
/ CHOOSE=ADJRSQ showpvalues stats=all STB;
output out=stdres p= predict r = resid;
run;

proc univariate data=stdres normal;
var resid;
run;

/*****************************************************************/
/*********** Assumption II : Checking Heteroscedasticity *****************/
/****************************************************************/

proc autoreg data= bhalla.GLMSELECT;
class mealcat;
model crime = yr_rnd mealcat some_col / archtest;
output out=r r=yresid;
run;

Note : Check P-value of Q statistics and LM tests. P-value greater than .05 indicates homoscedasticity.

Related Posts : 

  1. Checking Assumptions of Multiple Linear Regression with SAS
  2. Homoscedasticity Simplified with SAS
  3. Scoring Linear Regression Model with SAS
ListenData Logo
Spread the Word!
Share
Related Posts
About Author:
Deepanshu Bhalla

Deepanshu founded ListenData with a simple objective - Make analytics easy to understand and follow. He has over 10 years of experience in data science. During his tenure, he has worked with global clients in various domains like Banking, Insurance, Private Equity, Telecom and Human Resource.

0 Response to "Linear Regression Model with PROC GLMSELECT"

Post a Comment

Next → ← Prev
Looks like you are using an ad blocker!

To continue reading you need to turnoff adblocker and refresh the page. We rely on advertising to help fund our site. Please whitelist us if you enjoy our content.