Sas reg multi
-
Upload
wensheng-chang -
Category
Documents
-
view
249 -
download
0
Transcript of Sas reg multi
REG procedure:Multiple linear
regression2013.03.21
Outline
• Regression with more than one variables• Model selection
Syntax
PROC REG <options> ;MODEL dependents=<regressors> < / options > ;
RUN;
Y= X1 X2 X3 / selection=forward (backward, stepwise)
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;
Output
Output: figures
Example
proc reg corr;model y=x1 x2 x3 x4/pcorr1 pcorr2 selection=forward;plot residual.*predicted.;run;
Forward selection
Summary
Stepwise & backward selection
Example 2
Data;…X5=x1*x2;…;
proc reg corr;model y=x1 x2 x3 x4 x5/pcorr1 pcorr2 selection=forward;plot residual.*predicted.;run;
Selection result