EZ Study

Actuarial Biology Chemistry Economics Calculators Confucius Engineer
Physics
C.S.

The Most confusion regression question for Statistician
Which model to choose: Glm, Mixed, Genmod, Logistics, Glimmix

Download pdf • Simple Linear Regression Analysis in SAS, Regression Analysis Study Notes 1: Linear Regression

Confusion: If you have been working on regression in SAS, in particular, if you have been exposed to some fancy regression model, say, mixed model, random effect ,
you might easily get confused with a few other regression models? which model to choose: Glm, Mixed, Genmod, Logistics, Glimmix? Answer: The following picture explains the pros/cons for each regression model very clearly:

Each model serves a different purpose, and should be used with different types of data. Here are a few sample code for each model:

```PROC GLM DATA=data1;
CLASS CourseLevel expectknownever;
MODEL hours= CourseLevel expectknownever
/SS3
SOLUTION
SINGULAR=1E-07;
LSMEANS CourseLevel / PDIFF=ALL ;
LSMEANS CourseLevel expectknownever / PDIFF=ALL ;

PROC LOGISTIC DATA=data1 desc namelen=100;
CLASS BS (PARAM=EFFECT) workhabits (PARAM=EFFECT);
MODEL CourseLevel=BS workhabits hours /
SELECTION=NONE CLPARM=WALD CLODDS=WALD ALPHA=0.05                                                                                       <!--
/* Test */
//-->

LINK=PROBIT; /* use CLOGLOG for more than 2 levels */
OUTPUT OUT=out1(LABEL="Logistic regression predictions")
PREDPROBS=INDIVIDUAL;

PROC MIXED DATA =data1 METHOD=REML ;
CLASS CourseLevel Applied Statistics;
MODEL hours_modified= Applied CourseLevel Statistics
/HTYPE=3
DDFM=CONTAIN /*denominator degrees of freedom */
OUTPM=out2(LABEL="Predicted means")
OUTP=out3(LABEL="Predicted values");
RANDOM CourseLevel / G TYPE=VC;
LSMEANS Applied CourseLevel Statistics / PDIFF=ALL ;

PROC GENMOD DATA=data2;
CLASS Applied Statistics workhabits;
MODEL hours= Applied Statistics workhabits
DIST=GAMMA
TYPE3
CORRB /*parameter estimate correlation matrix*/
LRCI   /* two-sided confidence intervals */
CL /*confidence limits*/
ALPHA=0.05;
LSMEANS Applied Statistics workhabits / ALPHA=0.05;
OUTPUT OUT=out4
PREDICTED=_predicted1
RESDEV=_resdev1 RESCHI=_reschi1;
RUN; QUIT;

PROC glimmix DATA = data1;
CLASS CourseLevel Applied Statistics;
MODEL hours_modified= Applied CourseLevel Statistics
/HTYPE=3
DDFM=CONTAIN /*denominator degrees of freedom */
dist=gamma;
RANDOM CourseLevel / G TYPE=VC;
LSMEANS Applied CourseLevel Statistics / PDIFF=ALL ;
RUN;    QUIT;

```
Acknowledgement: The tutorial is based on the popular SAS paper by Dr Cerrito.

Continue to next: Data Preparation and data check before modeling   Stats 101 Home   SAS tutorial home
Back to: Classic regression home   Experiment Design & Data Analysis Home Statistics tutorial home