全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
1209 2
2010-08-22
请教高手,sas做岭回归的具体程序是怎样的?谢谢
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2010-8-22 14:37:13
options nocenter;
/* Read in the data */
data bodyfat;
        input skinfold thigh midarm fat;
        cards;
          19.5  43.1  29.1  11.9
  24.7  49.8  28.2  22.8
  30.7  51.9  37.0  18.7
  29.8  54.3  31.1  20.1
  19.1  42.2  30.9  12.9
  25.6  53.9  23.7  21.7
  31.4  58.5  27.6  27.1
  27.9  52.1  30.6  25.4
  22.1  49.9  23.2  21.3
  25.5  53.5  24.8  19.3
  31.1  56.6  30.0  25.4
  30.4  56.7  28.3  27.2
  18.7  46.5  23.0  11.7
  19.7  44.2  28.6  17.8
  14.6  42.7  21.3  12.8
  29.5  54.4  30.1  23.9
  27.7  55.3  25.7  22.6
  30.2  58.6  24.6  25.4
  22.7  48.2  27.1  14.8
  25.2  51.0  27.5  21.1
  ;

run;

/* Original Regression */
proc reg data = bodyfat;
        model fat = skinfold thigh midarm;
run;

/* Variables are highly correlated */
proc corr data = bodyfat noprob;
run;

/* Plot the ridge trace */
title1 'Ridge Trace';
title2 'Body Fat Example';
symbol1 v = S i = none c = black;
symbol2 v = T i = none c = black;
proc reg data = bodyfat outvif
        outest = bfout ridge = 0 to .03 by 0.002;
        model fat = skinfold thigh midarm / noprint;
        plot / ridgeplot nomodel nostat;
run;

title2 'Variance Inflation Factors';
proc gplot data = bfout;
        plot (skinfold thigh midarm)* _RIDGE_ / overlay;
        where _TYPE_ = 'RIDGEVIF';
run;


proc print data = bfout;
        var _RIDGE_ skinfold thigh midarm;
        where _TYPE_ = 'RIDGEVIF';

title2 'Parameter Estimates';
proc print data = bfout;
        var _RIDGE_ _RMSE_ Intercept skinfold thigh midarm;
        where _TYPE_ = 'RIDGE';
run;
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2010-8-22 14:37:40
把数据换成你的数据,结果你自己在好好研究!
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群