250 likes | 384 Views
第八章 稳健回归. §8.1 异常值. 我们给出如下的 SAS 模拟计算的程序: data a1; do i=1 to 10 ; set p183; r=rannor(1234567) ; if i=6 then y=-2-x+12+r; else y=-2-x+r; output; end; run;. proc reg data=a1 ; model y=x; output out=b1 p=y1hat; run; data a2; set a1; if x>5 then delete; run; proc reg data=a2;
E N D
我们给出如下的SAS模拟计算的程序: data a1; do i=1 to 10 ; set p183; r=rannor(1234567) ; if i=6 then y=-2-x+12+r; else y=-2-x+r; output; end; run;
proc reg data=a1 ; model y=x; output out=b1 p=y1hat; run; data a2; set a1; if x>5 then delete; run; proc reg data=a2; model y=x; output out=b2 p=y2hat; run;
proc gplot data=b; symbol1 v=star c=green I= none; symbol2 v=plus c=red i=l; symbol3 v=plus c=blue i=l; plot y*x haty1*x haty2*x/overlay; run; proc sort data=b1; by x; run; proc sort data=b2; by x; run; data b; merge b1 b2; run;