/*第1问*/
data anova;
input group $ @;
do i=1 to 4;
input x@@;
output;
end;
cards;
B13.52.62.01.4
B22.32.01.50.8
B32.01.91.20.3
;
proc anova;
class group;
model x=group;
means group/lsd;
run;
/*第2问*/
data score;
input no sex $ math phyeng;
cards;
9901F989391
9902M868285
9903M879465
9904F899078
9905F969882
9906M928789
;
run;
/*(1)*/
libname new "D:\user";
data new.newscore;
set score;
run;
/*(2)*/
proc means data=score;
var math phy eng;
output out=result;
run;
/*(3)*/
data result1;
set score;
sum=sum(math,phy,eng);
proc sort;
by sum;
run;
/*(4)*/
data A B;
set score;
if sex='M' then output A;
else output B;
run;
proc print data=A;
proc print data=B;
run;
/*第三问*/
data reg;
input x1-x3 y;
cards;
14 16 59 5.87
27 13 27 5.58
31 11 94 5.83
20 15 64 4.71
24 14 167 5.59
19 13 340 3.85
30 13 40 5.52
21 12 122 5.3
29 13 90 5.65
30 14 85 4.97
41 13 120 5.31
;
run;
/*(1)*/
proc reg data=reg;
model y=x1-x3/ sle=0.10 selection=forward;
model y=x1-x3/sls=0.10 selection=backward;
model y=x1-x3/sls=0.10 sle=0.10 selection=stepwise;
ods output selparmest=para;/*看参数估计,看三种方法模型是否相同,看每个模型的最
后一次参数估计,如果不同,选取R值最高的作为最优模型*/
run;
quit;
/*(2)*/
/*上述三个模型最终建立模型相同 y=bt0+bt3*x3 */
proc nlin data=reg;
parameters bt3=;/*参数初值设置刚才最优模型的参数估计值*/
model y=bt3*x3;/*或者写非线性模型*/
run;
/*第4问*/
data press1;
input press@@;
cards;
0.3 0.5 0.7 0.9 1.1 1.3 1.5 2.0
;
data press2;
input size@@;
cards;
11.28 9.82 8.76 7.26 7.92 7.26 8.40 6.04
;
data press;
merge press1 press2;
run;
proc gplot data=press;
symbol i=spline v=dot;
plot size*press;
label size="粒子大小" press="压力";
run;
quit;
/*根据图形,判断二者关系*/