PROC SGPLOT DATA = sashelp.class; scatter x=height y=weight;
ellipse x=height y=weight/alpha=0.3182; ellipse x=height y=weight/alpha=0.05; ellipse x=height y=weight/alpha=0.0027; TITLE \; RUN;
注:对生成的图形要进行编辑,需要下载SAS的图形编辑器。
注:ODS 统计图形的展现形式是由GTL语言编写的程序规定的。定义了 layouts(图形布局): lattices, overlays
types(作图类型): scatter plot,histograms titles(标题) footnotes(脚注)
insets(图形里插入符号和文字) colors(颜色) symbols(符号) lines(线的属性):线类,线宽,颜色
other elements:坐标轴的设置,背景,前景,等
/*回归分析*/
/*reg step 1 建立回归方程*/ data regdata; input x1-x4 y; datalines;
7 26 6 60 78.5 1 29 15 52 74.3 11 56 8 20 104.3 11 31 8 47 87.6 7 52 6 33 95.9 11 55 9 22 109.2 3 71 17 6 102.7
1 31 22 44 72.5 2 54 18 22 93.1 21 47 4 26 115.9 1 40 23 34 83.8 11 66 9 12 113.3 10 68 8 12 109.4 run;
proc reg data=regdata; model y=x1-x4; run;
/*识别多重共线性*/
proc reg data=regdata; model y=x1-x4/ vif collin; run;
/*⑶多重共线性的处理 ①选择变量法*/
/*逐步回归*/
proc reg data=regdata;
model y=x1-x4/selection=stepwise; run;
/*全子集法*/
proc reg data=regdata;
model y=x1-x4/selection=rsquare adjrsq cp aic bic rmse; run;
/*岭嵴回归*/
proc reg data=regdata outest=rghald outvif graphics corr; model y=x1-x4/ridge=0 to 1 by 0.1 2 3 4 5 6 ; plot/ridgeplot; run;
proc print data=rghald; run;
/*主成分回归*/
proc princomp data=regdata; var x1-x4; run;
proc reg data=regdata outest=pchald outvif; model y=x1-x4/pcomit=1,2 ; run;
proc print data=pchald;
run;
/*回归诊断*/
proc reg data=regdata graphics; model y=x1-x2/r ; plot student.*p.; run;