文档库 最新最全的文档下载
当前位置:文档库 › SAS考试

SAS考试

SAS考试
SAS考试

姓名:宋亚琼专业:营养与食品卫生学学号:12720306 第一题:程序

options nodate nonumber;

data zhang1;

input a b c d x@@;

cards;

1 1 1 1 78.9 1 1 1 1 78.1

1 2 2 2 77.0 1 2 2 2 77.0

1 3 3 3 77.5 1 3 3 3 78.5

2 1 2

3 80.1 2 1 2 3 80.9

2 2

3 1 77.6 2 2 3 1 78.4

2 3 1 2 78.0 2 3 1 2 79.0

3 1 3 2 76.7 3 1 3 2 76.3

3 2 1 3 81.3 3 2 1 3 82.7

3 3 2 1 79.5 3 3 2 1 78.5

;

proc anova;

class a b c d;

model x=a b c d;

means a b c d;

means a b c d/duncan;

means a b c d/duncan alpha=0.01;

run;

SAS 系统

The ANOVA Procedure

Class Level Information

Class Levels Values

a 3 1 2 3

b 3 1 2 3

c 3 1 2 3

d 3 1 2 3

Number of observations 18

SAS 系统

The ANOVA Procedure

Dependent Variable: x

Source DF Sum of Squares Mean Square F Value Pr > F

Model 8 46.00000000 5.75000000 14.70 0.0003 Error 9 3.52000000 0.39111111

Corrected Total 17 49.52000000

R-Square Coeff Var Root MSE x Mean

0.928918 0.794986 0.625389 78.66667

Source DF Anova SS Mean Square F Value Pr > F

a 2 6.33333333 3.16666667 8.10 0.0097

b 2 1.00000000 0.50000000 1.28 0.3246

c 2 14.33333333 7.16666667 18.32 0.0007

d 2 24.33333333 12.16666667 31.11 <.0001

SAS 系统

The ANOVA Procedure

Level of --------------x--------------

a N Mean Std Dev

1 6 77.8333333 0.79414524

2 6 79.0000000 1.27593103

3 6 79.1666667 2.52560224

Level of --------------x--------------

b N Mean Std Dev

1 6 78.5000000 1.82866071

2 6 79.0000000 2.42074369

3 6 78.5000000 0.70710678

Level of --------------x--------------

c N Mean St

d Dev

1 6 79.6666667 1.90438091

2 6 78.833333

3 1.62193300

3 6 77.5000000 0.88317609

Level of --------------x--------------

d N Mean Std Dev

1 6 78.5000000 0.65421709

2 6 77.333333

3 0.99129545

3 6 80.1666667 1.90438091

Duncan's Multiple Range Test for x

NOTE: This test controls the Type I comparisonwise error rate, not the experimentwise error rate.

Alpha 0.05

Error Degrees of Freedom 9

Error Mean Square 0.391111

Number of Means 2 3

Critical Range .8168 .8525

Means with the same letter are not significantly different.

Duncan Grouping Mean N a

A 79.1667 6 3

A

A 79.0000 6 2

B 77.8333 6 1

Duncan Grouping Mean N b

A 79.0000 6 2

A

A 78.5000 6 1

A

A 78.5000 6 3

Duncan Grouping Mean N c

A 79.6667 6 1

B 78.8333 6 2

C 77.5000 6 3

Duncan Grouping Mean N d

A 80.1667 6 3

B 78.5000 6 1

C 77.3333 6 2

Alpha 0.01

Error Degrees of Freedom 9

Error Mean Square 0.391111

Number of Means 2 3

Critical Range 1.173 1.222

Means with the same letter are not significantly different.

Duncan Grouping Mean N a

A 79.1667 6 3

A

B A 79.0000 6 2

B

B 77.8333 6 1

Duncan Grouping Mean N b

A 79.0000 6 2

A

A 78.5000 6 1

A

A 78.5000 6 3

Duncan Grouping Mean N c

A 79.6667 6 1

A

A 78.8333 6 2

B 77.5000 6 3

Duncan Grouping Mean N d

A 80.1667 6 3

B 78.5000 6 1

B

B 77.3333 6 2

结果分析:

1、方差分析结果表明:

茶园施肥3要素配合比例(A)、制茶工艺流程(C)、施肥用量(D)均达到的极显著水平(p<0.01),说明它们对提高炒青绿茶品质有显著效果,而鲜叶处理(B)对提高炒青绿茶品质影响不明显(P>0.05)。

2、用Duncan多重比较:鲜叶处理(B)三水平在P=0.05,P=0.01水平均无差异。

在P=0.05水平:茶园施肥3要素配合比例(A)水平1与2差异不显著,3与1,2差异显著。制茶工艺流程(C)和施肥用量(D)各水平两两间差异显著。因此最优组合:A3C1D3,B因素依据实际情况节约成本选

择配比。

在P=0.01水平:茶园施肥3要素配合比例(A)水平1、2差异不显著,水平2、3差异不显著,水平1、3差异显著。制茶工艺流程(C)水平1、2与3差异显著。施肥用量(D)水平1与2、3差异显著。因此最优组合:A3C1D3,B因素三水平任选其一。

即:提高炒青绿茶品质最优组合是:茶园施肥3要素配合比例水平3,制茶工艺流程水平1,施肥用量水平3。鲜叶处理(B)对提高炒青绿茶品质无影响。

第二题:

程序:

options nodate nonumber;

data zhang2;

input x1 x2 x3 y@@;

x4=x1*x2;x5=x1*x3;

x6=x2*x3;x7=x1*x1;

x8=x2*x2;x9=x3*x3;

cards;

380 140 1.7 4800

380 140 1.3 5050

380 110 1.7 3900

380 110 1.3 4750

320 140 1.7 3900

320 140 1.3 3700

320 110 1.7 3700

320 110 1.3 3850

400 125 1.5 5000

300 125 1.5 3600

350 150 1.5 4400

350 100 1.5 3950

350 125 1.8 4700

350 125 1.2 4750

350 125 1.5 4850

350 125 1.5 4550

350 125 1.5 4400

350 125 1.5 4300

350 125 1.5 4750

350 125 1.5 4350

;

proc reg;model y=x1-x9/selection=backward sls=0.05;run;

输出结果:

SAS 系统

Model: MODEL1

Dependent Variable: y

Backward Elimination: Step 0

All Variables Entered: R-Square = 0.9028 and C(p) = 10.0000

Analysis of Variance

Source DF Sum of Squares MeanSquare F Value Pr > F

Model 9 3822975 424775 10.33 0.0006

Error 10 411400 41140

Corrected Total 19 4234375

arameter Standard

Variable Estimate Error Type II SS F Value Pr > F

Intercept -19699 14014 81290 1.98 0.1901

x1 107.65217 49.84095 191927 4.67 0.0561

x2 28.18382 89.48203 4081.23636 0.10 0.7593

x3 1231.85680 7001.68111 1273.44333 0.03 0.8639

x4 0.31944 0.15936 165313 4.02 0.0728

x5 -23.95833 11.95186 165312 4.02 0.0728

x6 39.58333 23.90373 112813 2.74 0.1287

x7 -0.13953 0.05998 222661 5.41 0.0423

x8 -0.75811 0.23990 410836 9.99 0.0102

x9 585.21440 1581.64999 5632.13527 0.14 0.7191

Bounds on condition number: 736.66, 34697

------------------------------------------------------------------------------------------------

Backward Elimination: Step 1

Variable x3 Removed: R-Square = 0.9025 and C(p) = 8.0310

Analysis of Variance Source DF Sum of Squares MeanSquare F Value Pr > F

Model 8 3821702 477713 12.73 0.0001

Error 11 412673 37516

Corrected Total 19 4234375

Parameter Standard

Variable Estimate Error Type II SS F Value Pr > F

Intercept -18224 10726 108313 2.89 0.1174

x1 105.55552 46.21447 195713 5.22 0.0432

x2 25.18861 83.88897 3382.29882 0.09 0.7696

x4 0.31944 0.15218 165313 4.41 0.0597

x5 -22.70203 9.15238 230821 6.15 0.0305

x6 41.37805 20.64365 150723 4.02 0.0703

x7 -0.13923 0.05725 221878 5.91 0.0333

x8 -0.75690 0.22900 409861 10.93 0.0070

x9 773.79525 1110.65559 18210 0.49 0.5004

Backward Elimination: Step 2

Variable x2 Removed: R-Square = 0.9017 and C(p) = 6.1132

Analysis of Variance

Source DF Sum of Squares MeanSquare F Value Pr > F

Model 7 3818320 545474 15.73 <.0001

Error 12 416055 34671

Corrected Total 19 4234375

Parameter Standard

Variable Estimate Error Type II SS F Value Pr > F

Intercept -16013 7496.69573 158195 4.56 0.054

x1 101.89259 42.85214 196024 5.65 0.0349

x4 0.34846 0.11302 329546 9.50 0.0095

x5 -23.09881 8.70638 244047 7.04 0.0211

x6 43.60870 18.51601 192319 5.55 0.0364

x7 -0.13832 0.05496 219616 6.33 0.0271

x8 -0.71032 0.16193 667116 19.24 0.0009

x9 727.36029 1057.31947 16408 0.47 0.5046

Backward Elimination: Step 3

Variable x9 Removed: R-Square = 0.8979 and C(p) = 4.5120

Analysis of Variance

Source DF Sum of Squares Mean Square F Value Pr > F Model 6 3801912 633652 19.05 <.0001 Error 13 432463 33266

Corrected Total 19 4234375

Parameter Standard

Variable Estimate Error Type II SS F Value Pr > F

Intercept -15230 7257.98822 146473 4.40 0.0560

x1 97.56637 41.52052 183688 5.52 0.0352

x4 0.33947 0.10997 317004 9.53 0.0087

x5 -18.77911 5.90745 336168 10.11 0.0073

x6 48.91332 16.48941 292718 8.80 0.0109

x7 -0.13979 0.05379 224655 6.75 0.022

x8 -0.72952 0.15625 725188 21.80 0.0004

All variables left in the model are significant at the 0.0500 level.

Summary of Backward Elimination

Variable Number Partial Model

tep Removed Vars In R-Square R-Square C(p) F Value Pr > F

1 x3 8 0.0003 0.9025 8.0310 0.03 0.863

2 x2 7 0.0008 0.9017 6.1132 0.09 0.7696

3 x9 6 0.0039 0.8979 4.5120 0.47 0.5046

第二题第三小题程序:

data tan;

do x1=300 to 400 by 2;

do x2=100 to 150 by 1;

do x3=1.2 to 1.8 by 0.05;

y=-15230+97.56637*x1+0.33947*x1*x2-18.77911*x1*x3+48.91332*x2*x3-0.1397 9*x1*x1-0.72952*x2*x2;

output;end;end;end;

proc rank descending;var y;ranks ry;

proc print;

proc g3d;

plot x1*x2=y;plot x1*x3=y;plot x2*x3=y;

run;

结果分析:

(1)本试验采用二次旋转设计,逐步淘汰法,剔除标准为p=0.05,最终去除了x9,x2,x3三个差异不显著因素,最终留下6个变量,得到二次式方程,即:

y=-15230+97.56637*x1+0.33947*x1*x2-18.77911*x1*x3+4

8.91332*x2*x3-0.13979*x1*x1-0.72952*x2*x2;

此方程的拟合效果最好(F= 19.05 ,R2=0.8979,p<0.01)。

(2)依据最优回归方程,进行计算机模拟试验,列出10个最高产量水平组合:

(3)

相关文档