第八章 稳健回归8.1 异常值我们给出如下的SAS 模拟计算的程序:libname tjd:user;data tj.a1;do i=1 to 10 ;set tj.p183;r=normal(1234567) ;if i=6 then y=-2-x+12+r;else y=-2-x+r;output;end;run;proc reg data=tj.a1 ;model y=x;output out=b1 p=y1hat;run;data tj.a2;set tj.a1;if x5 then delete;run;proc reg data=tj.a2;model y=x;output out=b2 p=y2hat;run;proc sort data=b1;by x;run;proc sort data=b2;by x;run;data b;merge b1 b2;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*