Sas reg multi

12
REG procedure: Multiple linear regression 2013.03.21

Transcript of Sas reg multi

Page 1: Sas reg multi

REG procedure:Multiple linear

regression2013.03.21

Page 2: Sas reg multi

Outline

• Regression with more than one variables• Model selection

Page 3: Sas reg multi

Syntax

PROC REG <options> ;MODEL dependents=<regressors> < / options > ;

RUN;

Y= X1 X2 X3 / selection=forward (backward, stepwise)

Page 4: Sas reg multi

Example

data example;do i=1 to 500; x1=100+20*rannor(20130321); x2=50+20*rannor(20130321); x3=(x1+x2)+5*rannor(20130321); x4=exp(3*rannor(20130321)); e=20*rannor(20130321); y=x1+3*x2+2*x3+e; output;end;

proc reg corr;model y=x1 x2 x3 x4/pcorr1 pcorr2;plot residual.*predicted.;run;

Page 5: Sas reg multi

Output

Page 6: Sas reg multi

Output: figures

Page 7: Sas reg multi

Example

proc reg corr;model y=x1 x2 x3 x4/pcorr1 pcorr2 selection=forward;plot residual.*predicted.;run;

Page 8: Sas reg multi

Forward selection

Page 9: Sas reg multi

Summary

Page 10: Sas reg multi

Stepwise & backward selection

Page 11: Sas reg multi

Example 2

Data;…X5=x1*x2;…;

proc reg corr;model y=x1 x2 x3 x4 x5/pcorr1 pcorr2 selection=forward;plot residual.*predicted.;run;

Page 12: Sas reg multi

Selection result