SAS选修作业要点

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

1:今有某种型号的电池三批,它们分别是A、B、C三个工厂所生产的,为评比其质量,各随机抽取5只电池为样品,经试验得其寿命(h)如下:
A B C
4042 4845
38 2628
3432
30
39 50
40 50
43
试在显著性水平0.05下检验电池的平均寿命有无显著的差异,若差异是显著的,试求均差
μA-μB,μA-μC和μB-μC的置信水平为95%的置信区间。

(1)程序
data l1;
do i=1to5;
do g=1to3;
input x@@;
output;end;end;
cards;
40 26 39 42 28 50 48 34 40 45 32 50 38 30 43
proc anova;
class g;
model x=g;
means g;
run;
Dependent Variable: x
Sum of
Source DF Squares Mean Square F Value Pr > F
Model 2 615.6000000 307.8000000 17.07 0.0003 Error 12 216.4000000 18.0333333
Corrected Total 14 832.0000000
R-Square Coeff Var Root MSE x Mean
0.739904 10.88863 4.246567 39.00000
Source DF Anova SS Mean Square F Value Pr >
结果分析:因为P=0.0003<0.05,所以电池的平均寿命有显著的差异。

μA-μB,μA-μC和μB-μC的置信水平为95%的置信区间分别为(9.3621,15.838),(-9.721,6.1214),(-21.88,-6.919).
2:为了寻找飞机控制面板上仪器表的最佳布置,试验了三个方案,观察领航在紧急情况的
反应时间(以1/10秒记),随机地选择28名领航员,得到他们对于不同的布局方案的反应
时间如下:
方案Ⅰ14 13 9 15 11 13 14 11
方案Ⅱ10 12 7 11 8 12 9 10 13 9 10 9
方案Ⅲ11 5 9 10 6 8 8 7
试在显著性水平0.05下检验各个方案的反应时间有无显著的差异,若有差异,试求μ1-μ2,μ1-μ3,μ2-μ3的置信水平为0.95的置信区间。

程序:
data l2;
input type$ n;
do i=1to n;
input x@@;
output;end;
cards;
m1 8
14 13 9 15 11 13 14 11
m2 12
10 12 7 11 8 12 9 10 13 9 10 9
m3 8
11 5 9 10 6 8 8 7
proc anova;
class type;
model x=type;
means type;
run;
Dependent Variable: x
Sum of
Source DF Squares Mean Square F Value Pr > F
Model 2 81.4285714 40.7142857 11.31 0.0003 Error 25 90.0000000 3.6000000
Corrected Total 27 171.4285714
R-Square Coeff Var Root MSE x Mean
0.475000 18.70643 1.897367 10.14286
结果分析:因为P=0.0003<0.05,所以各个方案的反应时间有显著的差异。

μ1-μ2,μ1-μ3,μ2-μ3的置信水平为0.95的置信区间分别为(0.72,4.28),(2.36,6.64),(0.22,3.78)。

3:某防治站对4个林场的松毛虫密度进行调查,每个林场调查5块地得资料如下表:地点松毛虫密度(头/标准地)
192 189 176 185 190
190 201 187 196 200
188 179 191 183 194
187 180 188 175 182
判断4个林场松毛从密度有无显著差异,取显著性水平α=0.05.
程序
data t3;
do b=1to5;
do a=1to4;
input x@@;
output;
end;
end;
cards;
192 190 188 187 189 201 179 180 176 187 191 188
185 196 183 175 190 200 194 182
proc anova;
class a;
model x=a;
run;
Sum of
Source DF Squares Mean Square F Value Pr > F
Model 3 403.3500000 134.4500000 3.77 0.0321
Error 16 571.2000000 35.7000000
Corrected Total 19 974.5500000
R-Square Coeff Var Root MSE x Mean
0.413883 3.184091 5.974948 187.6500
Source DF Anova SS Mean Square F Value Pr > F
a 3 403.3500000 134.4500000 3.77 0.0321 结果分析:因为P=0.0321<0.05,所以4个林场松毛从密度有显著差异。

4:一试验用来比较4种不同药品解除外科手术后疼痛的延长时间(h),结果如下表:药品时间长度(h)
A 8 6 4 2
B 6 6 4 4
C 8 10 10 10 12
D 4 4 2
试在显著性水平α=0.05下检验各种药品对解除疼痛的延续时间有无显著差异。

程序
data t4;
input type$ n;
do i=1to n;
input x@@;
output; end; cards;
M1 4
8 6 4 2
M2 4
6 6 4 4
M3 5
8 10 10 10 12
M4 3
4 4 2
proc anova;
class type;
model x=type;
run;
Sum of
Source DF Squares Mean Square F Value Pr > F
Model 3 108.3333333 36.1111111 12.50 0.0005
Error 12 34.6666667 2.8888889
Corrected Total 15 143.0000000
R-Square Coeff Var Root MSE x Mean
0.757576 27.19477 1.699673 6.250000
Source DF Anova SS Mean Square F Value Pr > F
type 3 108.3333333 36.1111111 12.50 0.0005 结果分析:因为P=0.0005<0.05,所以在显著性水平α=0.05下,各种药品对解除疼痛的延续时间有显著差异。

5:将抗生素注入人体会产生抗生素与血浆蛋白质结合的现象。

以致减少了药效,下表列出5种常用的抗生素注入到牛的体内时,抗生素与血浆蛋白质结合的百分比。

试在水平α=0.05下检验这些百分比的均值有无显著的差异。

青霉素四环素链霉素红霉素氯霉素
29.6 27.3 5.8 21.6 29.2
24.3 32.6 6.2 17.4 32.8
28.5 30.8 11.0 18.3 25.0
32.0 34.8 8.3 19.0 24.2
程序
data t5;
do b=1to4;
do a=1to5;
input x@@;
output;
end;
end;
cards;
29.6 27.3 5.8 21.6 29.2 24.3 32.6 6.2 17.4 32.8
28.5 30.8 11.0 18.3 25.0 32.0 34.8 8.3 19.0 24.2
proc anova;
class a;
model x=a;
run;
Sum of
Source DF Squares Mean Square F Value Pr > F
Model 4 1480.823000 370.205750 40.88 <.0001
Error 15 135.822500 9.054833
Corrected Total 19 1616.645500
R-Square Coeff Var Root MSE x Mean
0.915985 13.12023 3.009125 22.93500
Source DF Anova SS Mean Square F Value Pr > F
a 4 1480.823000 370.205750 40.88 <.0001 结果分析:因为P<0.0001,所以在水平α=0.05下这些百分比的均值有显著的差异。

6:下表给出某种化工过程在三种浓度、四种温度水平下得率的数据:
温度(因素B)
10℃24℃38℃52℃
浓度(因素A)2% 14 10 11 11 13 9 10 12 4% 9 7 10 8 7 11 6 10 6% 5 11 13 14 12 13 14 10
试在显著性水平α=0.05下检验:在不同浓度下得率的均值是否有显著差异,在不同温度下得率的均值是否有显著差异,交互作用的效应是否显著。

程序
data t6;
do a= 1to3;
do b= 1to4;
do c= 1 to 2;
input x@@;
output;
end;
end;
end;
drop c;
cards;
14 10 11 11 13 9 10 12
9 7 10 8 7 11 6 10
5 11 13 14 12 13 14 10
proc anova;
class a b;
model x=a b a*b;
run;
Sum of
Source DF Squares Mean Square F Value Pr > F
Model 11 82.8333333 7.5303030 1.39 0.2895 Error 12 65.0000000 5.4166667
Corrected Total 23 147.8333333
R-Square Coeff Var Root MSE x Mean
0.560316 22.34278 2.327373 10.41667
Source DF Anova SS Mean Square F Value Pr > F
a 2 44.33333333 22.16666667 4.09 0.0442
b 3 11.50000000 3.83333333 0.71 0.5657
a*b 6 27.00000000 4.50000000 0.83 0.5684 结果分析:因为
Pr(a)=0.0442<0.05,Pr(b)=0.5657>0.05,Pr(a*b)=0.5684>0.05,
所以只有浓度的影响是显著的。

7:为了研究金属管的防腐的功能,考虑了4种不同的涂料涂层。

将金属管设在3种不同性质的土壤中,经历了一定时间,测得金属管腐蚀的最大深度如下所示(以mm计):
土壤类型(因素B)
涂层(因素A)1 2 3
1.63 1.35 1.27 1.34 1.30 1.22 1.19 1.14 1.27 1.30 1.09 1.32
试取显著性水平α=0.05检验在不同涂层下腐蚀的最大深度的平均值有无显著差异,在不同
土壤下腐蚀的最大深度的平均值有无显著差异。

设两因素间没有交互作用效应。

程序
data t7;
do a= 1to4;
do b= 1to3;
input x@@;
output;
end;
end;
cards;
1.63 1.35 1.27 1.34 1.30 1.22 1.19 1.14 1.27 1.30 1.09 1.32
proc anova;
class a b;
model x=a b;
Sum of
Source DF Squares Mean Square F Value Pr > F
Model 5 0.12410000 0.02482000 1.94 0.2209 Error 6 0.07660000 0.01276667
Corrected Total 11 0.20070000
R-Square Coeff Var Root MSE x Mean
0.618336 8.792971 0.112990 1.285000
Source DF Anova SS Mean Square F Value Pr > F
a 3 0.08070000 0.02690000 2.11 0.2007
b 2 0.04340000 0.02170000 1.70 0.2601
结果分析:因为Pr(a)=0.2007>0.05,Pr(b)=0.2601>0.05,所以因素A、因素B的影响均不显著。

8:下表数据是退火温度X(℃)对黄铜诞性Y效应的试验结果,Y是以延长度计算的。

X(℃) 300 400 500 600 700 800
Y(%) 40 50 55 60 67 70
画出散点图并求出Y对x的现行回归方程。

程序
data T8 ;
input x y@@;
cards;
300 40 400 50 500 55 600 60 700 67 800 70
proc reg;
model y=x ;
proc plot;
plot y*x;
run;
Sum of Mean
Source DF Squares Square F Value Pr > F
Model 1 606.22857 606.22857 176.08 0.0002
Error 4 13.77143 3.44286
Corrected Total 5 620.00000
Root MSE 1.85549 R-Square 0.9778
Dependent Mean 57.00000 Adj R-Sq 0.9722
Coeff Var 3.25525
Parameter Estimates
Parameter Standard
Variable DF Estimate Error t Value Pr > |t|
Intercept 1 24.62857 2.55441 9.64 0.0006
x 1 0.05886 0.00444 13.27 0.0002
结果分析:因为b=0.05886,a=24.62857,所以回归方程为
y=24.62857+0.05886x
9:在钢线碳含量对于电阻的效应的研究中,得到一下的数据:
碳含量x(%)0.10 0.30 0.40 0.55 0.70 0.80 0.95
15 18 19 21 22.6 23.8 26 20℃时电阻y(μ
Ω)
(1)画出散点图.
(2)求线回归方程错误!未找到引用源。

.
(3)求ε的方差σ2的无偏估计.
(4)检验假设H0:b=0,H1:b≠0.
(5)若回归效果显著,求b的置信水平0.95的置信区间.
(6)求x=0.50处μ(x)的置信水平为0.95的置信区间.
(7)求x=0.50处观察值Y的置信水平为0.95的预测区间.
程序
data t9;
input x y@@;
cards;
0.10 15 0.30 18 0.40 19 0.55 21 0.70 22.6 0.8 23.8 0.95 26 0.50 .
proc reg;
model y=x /clm cli;
proc plot;
plot y*x;
run;
Sum of Mean
Source DF Squares Square F Value Pr > F
Model 1 83.81831 83.81831 1940.48 <.0001
Error 5 0.21597 0.04319
Corrected Total 6 84.03429
Root MSE 0.20783 R-Square 0.9974
Dependent Mean 20.77143 Adj R-Sq 0.9969
Coeff Var 1.00057
Parameter Estimates
Parameter Standard
Variable DF Estimate Error t Value Pr > |t|
Intercept 1 13.95839 0.17347 80.47 <.0001
x 1 12.55034 0.28491 44.05 <.0001
The REG Procedure
Model: MODEL1
Dependent Variable: y
Output Statistics
Dep Var Predicted Std Error
Obs y Value Mean Predict 95% CL Mean 95% CL Predict Residual
1 15.0000 15.2134 0.1486 14.8314 15.5955 14.5566 15.870
2 -0.2134
2 18.0000 17.7235 0.1047 17.4544 17.9926 17.125
3 18.3217 0.2765
3 19.0000 18.9785 0.0885 18.7511 19.2059 18.3979 19.5592 0.0215
4 21.0000 20.8611 0.0786 20.6591 21.0631 20.2899 21.4322 0.1389
5 22.6000 22.743
6 0.0904 22.5112 22.9760 22.1610 23.3262 -0.1436
6 23.8000 23.998
7 0.1074 23.7225 24.274
8 23.3973 24.6000 -0.1987
7 26.0000 25.8812 0.1401 25.5211 26.2413 25.2369 26.5255 0.1188
8 . 20.2336 0.0795 20.0292 20.4379 19.6616 20.8056 .
Sum of Residuals 0
Sum of Squared Residuals 0.21597
Predicted Residual SS (PRESS) 0.50730
结果分析:(2)因为b=12.5503,a=13.9584,所以y=12.5503x+13.9584(3)ε的方差σ2的无偏估计为0.0432(4)因Pr(b)<0.001,所以回归效果显著。

(6)x=0.50处μ(x)的置信水平为0.95的置信区间为(20.03,20.44)(7)x=0.50处观察值Y的置信水平为0.95的预测区间为(19.66,20.81)
10:下表列出了18个5~8岁儿童的重量(这是容易测得的)和体积(这是难以测得的)
重量x(kg)17.1 10.5 13.8 15.7 11.9 10.4 15.0 16.0 17.8 体积y(dm3)16.7 10.4 13.5 15.7 11.6 10.2 14.5 15.8 17.6 重量x(kg)15.8 15.1 12.1 18.4 17.1 16.7 16.5 15.1 15.1 体积y(dm3)15.2 14.8 11.9 18.3 16.7 16.6 15.9 15.1 14.5 (1)画出散点图.
(2)求Y关于x的线性回归方程错误!未找到引用源。

.
(3)求x=14.0时Y的置信水平为0.95的预测区间.
程序
data t10;
input x y@@;
cards;
17.1 16.7 10.5 10.4 13.8 13.5 15.7 15.7 11.9 11.6 10.4 10.2 15.0 14.5 16.0
15.8 17.8 17.6
15.8 15.2 15.1 14.8 12.1 11.9 18.4 18.3 17.1 16.7 16.7 16.6 16.5 15.9 15.1
15.1 15.1 14.5
14.0 .
proc reg;
model y=x/cli ;
proc plot;
plot y*x;
run;
Sum of Mean
Source DF Squares Square F Value Pr > F
Model 1 94.09987 94.09987 2311.89 <.0001
Error 16 0.65124 0.04070
Corrected Total 17 94.75111
Root MSE 0.20175 R-Square 0.9931
Dependent Mean 14.72222 Adj R-Sq 0.9927
Coeff Var 1.37037
Parameter Estimates
Parameter Standard
Variable DF Estimate Error t Value Pr > |t|
Intercept 1 -0.10405 0.31200 -0.33 0.7431
x 1 0.98805 0.02055 48.08 <.0001
The REG Procedure
Model: MODEL1
Dependent Variable: y
Output Statistics
Dep Var Predicted Std Error
Obs y Value Mean Predict 95% CL Predict Residual
1 16.7000 16.7916 0.0641 16.3429 17.2404 -0.0916
2 10.4000 10.2705 0.1041 9.7892 10.7517 0.1295
3 13.5000 13.5311 0.0536 13.0885 13.9736 -0.0311
4 15.7000 15.4084 0.0496 14.9679 15.8488 0.2916
5 11.6000 11.6538 0.079
6 11.1940 12.1135 -0.0538
6 10.2000 10.171
7 0.1059 9.6887 10.6547 0.0283
7 14.5000 14.7167 0.0476 14.2773 15.1561 -0.2167
8 15.8000 15.7048 0.0518 15.2632 16.1463 0.0952
9 17.6000 17.4833 0.0746 17.0273 17.9392 0.1167
10 15.2000 15.5072 0.0503 15.0664 15.9479 -0.3072
11 14.8000 14.8155 0.0476 14.3761 15.2550 -0.0155
12 11.9000 11.8514 0.0763 11.3941 12.3087 0.0486
13 18.3000 18.0761 0.0844 17.6125 18.5397 0.2239
14 16.7000 16.7916 0.0641 16.3429 17.2404 -0.0916
15 16.6000 16.3964 0.0589 15.9509 16.8420 0.2036
16 15.9000 16.1988 0.0566 15.7546 16.6430 -0.2988
17 15.1000 14.8155 0.0476 14.3761 15.2550 0.2845
18 14.5000 14.8155 0.0476 14.3761 15.2550 -0.3155
19 . 13.7287 0.0518 13.2871 14.1703 .
Sum of Residuals 0
Sum of Squared Residuals 0.65124
Predicted Residual SS (PRESS) 0.77786
结果分析:(2)因b=0.988,a=-0.104,所以y=0.988x-0.104。

(3)当 x=14.0时Y的置信水平为0.95的预测区间为(13.29,14.17)。

11:蟋蟀用一个翅膀在另一翅膀上迅速地滑动,从而发出吱吱喳喳的叫声。

生物学家知道叫
声的频率x与气温Y具有线性关系。

下表列出了15对频率与气温间的对应关系的观察结果:
频率x i(叫声数/
20.0 16.0 19.8 18.4 17.1 15.5 14.7 17.1
秒)
气温y i(℃) 31.4 22.0 34.1 29.1 27.0 24.0 20.9 27.8 频率x i(叫声数/
15.4 16.2 15.0 17.2 16.0 17.0 14.4
秒)
气温y i(℃) 20.8 28.5 26.4 28.1 27.0 28.6 24.6
试求Y关于x的线性回归方程。

程序
data t11;
input x y@@;
cards;
20.0 31.4 16.0 22.0 19.8 34.1 18.4 29.1 17.1 27.0 15.5 24.0 14.7 20.9 17.1 27.8
15.4 20.8 16.2 28.5 15.0 26.4 17.2 28.1 16.0 27.0 17.0 28.6 14.4 24.6
proc reg;
model y=x ;
run;
Sum of Mean
Source DF Squares Square F Value Pr > F
Model 1 136.41142 136.41142 30.20 0.0001
Error 13 58.72591 4.51738
Corrected Total 14 195.13733
Root MSE 2.12541 R-Square 0.6991
Dependent Mean 26.68667 Adj R-Sq 0.6759
Coeff Var 7.96432
Parameter Estimates
Parameter Standard
Variable DF Estimate Error t Value Pr > |t|
Intercept 1 -3.85494 5.58491 -0.69 0.5022
x 1 1.83396 0.33374 5.50 0.0001
结果分析:因为a=1.83396,b=-3.85494,所以y= 1.83396x-3.85494 . 12:下面列出了自1952年~2004年各界奥林匹克运动会男子10000米赛跑的冠军的成绩(时间按min计):
年份(x) 1952 1956 1960 1964 1968 1972 1976
成绩(y) 29.3 28.8 28.5 28.4 29.4 27.6 27.7
年份(x) 1980 1984 1988 1992 1996 2000 2004
成绩(y) 27.7 27.8 27.4 27.8 27.1 27.3 27.1
(1)求Y关于x的线性回归方程错误!未找到引用源。

.
(2)检验假设H0:b=0,H1:b≠0(显著性水平α=0.05).
(3)求2008年冠军成绩的预测值.
程序
data t12;
input x y@@;
cards;
1952 29.3 1956 28.8 1960 28.5 1964 28.4 1968 29.4 1972 27.6 1976 27.7
1980 27.7 1984 27.8 1988 27.4 1992 27.8 1996 27.1 2000 27.3 2004 27.1
2008 .
proc reg;
model y=x/p ;
run;
Sum of Mean
Source DF Squares Square F Value Pr > F
Model 1 5.58647 5.58647 33.47 <.0001
Error 12 2.00281 0.16690
Corrected Total 13 7.58929
Root MSE 0.40854 R-Square 0.7361
Dependent Mean 27.99286 Adj R-Sq 0.7141
Coeff Var 1.45943
Parameter Estimates
Parameter Standard
Variable DF Estimate Error t Value Pr > |t|
Intercept 1 105.48264 13.39429 7.88 <.0001
x 1 -0.03918 0.00677 -5.79 <.0001
Dep Var Predicted
Obs y Value Residual
1 29.3000 29.0114 0.2886
2 28.8000 28.8547 -0.0547
3 28.5000 28.6980 -0.1980
4 28.4000 28.5413 -0.1413
5 29.4000 28.384
6 1.0154
6 27.6000 28.2279 -0.6279
7 27.7000 28.0712 -0.3712
8 27.7000 27.9145 -0.2145
9 27.8000 27.7578 0.0422
10 27.4000 27.6011 -0.2011
11 27.8000 27.4444 0.3556
12 27.1000 27.2877 -0.1877
13 27.3000 27.1310 0.1690
14 27.1000 26.9743 0.1257
15 . 26.8176 .
Sum of Residuals 0
Sum of Squared Residuals 2.00281
Predicted Residual SS (PRESS) 2.52888
结果分析:(1)Y关于x的线性回归方程为y=105.4826-0.0392x。

(2)因两系数的P值都小于0.05,所以回归效果显著。

(3)2008年冠军成绩的预测值为26.82。

13:以x与Y分别表示人的脚长(英寸)与手长(英寸),下面列出了15名女子的脚的长度x与手的长度Y的样本值:
x 9.00 8.50 9.25 9.75 9.00 10.00 9.50 9.00 y 6.50 6.25 7.25 7.00 6.75 7.00 6.50 7.00 x 9.25 9.50 9.25 10.00 10.00 9.75 9.50
y 7.00 7.00 7.00 7.50 7.25 7.25 7.25
(1)求Y关于x的线回归方程错误!未找到引用源。

.
(2)求b的置信水平为0.95的置信区间.
程序
data t13;
input x y@@;
cards;
9.00 6.50 8.50 6.25 9.25 7.25 9.75 7.00 9.00 6.75 10.00 7.00 9.50 6.50
9.00 7.00
9.25 7.00 9.50 7.00 9.25 7.00 10.00 7.50 10.00 7.25 9.75 7.25 9.50 7.25
proc reg;
model y=x /clb;
proc plot;
plot y*x;
run;
Sum of Mean
Source DF Squares Square F Value Pr > F
Model 1 0.78526 0.78526 12.40 0.0038
Error 13 0.82308 0.06331
Corrected Total 14 1.60833
Root MSE 0.25162 R-Square 0.4882
Dependent Mean 6.96667 Adj R-Sq 0.4489
Coeff Var 3.61180
Parameter Estimates
Parameter Standard
Variable DF Estimate Error t Value Pr > |t| 95% Confidence Limits
Intercept 1 1.89615 1.44124 1.32 0.2110 -1.21746
5.00976
x 1 0.53846 0.15290 3.52 0.0038 0.20815 0.86877
结果分析:(1)因为b=0.53846,a=1.89615,所以y=0.53846x+1.89615 (2) b的置信区间为(0.208,0.869)。

14:槲寄生是一种寄生在大树上部树枝上的寄生植物,它喜欢寄生在年轻大树上。

下面给出在一定条件下完成的试验中采集的数据:
大树的年龄x
(年)
3 4 9 15 40
每株大树上槲寄生的株数y 28 10 15 6 1 33 36 22 14 1 22 24 10 9
(1)作出(x i,y i)的散点图.
(2)令z i =lny i,作出(x i,z i)的散点图.
(3)以模型Y=ae bxε,lnε~N(0,σ2)拟合数据,其中a,b,σ2与x无关。

试求曲线回归方程错误!未找到引用源。

.
程序
data t14;
input x y@@; z=log(y);y1=log(y);
cards;
3 28 3 33 3 22
4 10 4 36 4 24 9 1
5 9 22 9 10 15
6 15 14 15 9 40 1 40 1
proc plot;
plot y*x;
proc plot;
plot z*x;
proc reg;
model y1=x;
run;
Sum of Mean
Source DF Squares Square F Value Pr > F
Model 1 15.46017 15.46017 110.86 <.0001
Error 12 1.67350 0.13946
Corrected Total 13 17.13367
Root MSE 0.37344 R-Square 0.9023
Dependent Mean 2.40812 Adj R-Sq 0.8942
Coeff Var 15.50760
Parameter Estimates
Parameter Standard
Variable DF Estimate Error t Value Pr > |t|
Intercept 1 3.47987 0.14256 24.41 <.0001
x 1 -0.08673 0.00824 -10.53 <.0001
结果分析:由程序知a=e3.47987=32.4556,b=-0.08673,所以y=32.4556 e-0.08673x
15:一种合金在某种添加剂的不同浓度之下,各做三次试验,得数据如下:
浓度x 10.0 15.0 20.0 25.0 30.0
抗压强度y 25.2 29.8 31.2 31.7 29.4
27.3 31.1 32.6 30.1 30.8
28.7 27.8 29.7 32.3 32.8
(1)做散点图.
(2)以模型Y=b0+b1x+b2x2+ε,ε~N(0,σ2)拟合数据,其中b0,b1x,b2,σ2与x无关,求回归方程错误!未找到引用源。

.
程序
data t15;
input x y@@;
x1=x*x;
cards;
10.0 25.2 10.0 27.3 10.0 28.7 15.0 29.8 15.0 31.1 15.0 27.8 20.0 31.2 20.0 32.6 20.0 29.7
25.0 31.7 25.0 30.1 25.0 32.3 30.0 29.4 30.0 30.8 30.0 32.8
proc reg;
model y = x x1;
proc plot;
plot y*x;
run;
Sum of Mean
Source DF Squares Square F Value Pr > F
Model 2 38.93714 19.46857 9.54 0.0033
Error 12 24.47619 2.03968
Corrected Total 14 63.41333
Root MSE 1.42817 R-Square 0.6140
Dependent Mean 30.03333 Adj R-Sq 0.5497
Coeff Var 4.75530
Parameter Estimates
Parameter Standard
Variable DF Estimate Error t Value Pr > |t|
Intercept 1 19.03333 3.27755 5.81 <.0001
x 1 1.00857 0.35643 2.83 0.0152
x1 1 -0.02038 0.00881 -2.31 0.0393
结果分析:由程序可知b1=1.00857,b2=-0.02038,b0=19.0333,所以y=19.0333+1.00857x-0.02038 x2
练习题3:
程序:
data L1;
input x1 x2 y@@;
cards;
1500 5000 96000
1500 4000 95000
3300 3000 95000
4200 2500 94000
2000 2000 90000
2500 2500 92000
2300 3500 95000
2500 3000 94000
proc reg;
model y=x1 x2/tol vif collin selection=stepwise r ;
run;
The SAS System 12:43 Tuesday, May 13, 2013 1
The REG Procedure
Model:
MODEL1
Dependent Variable: y
Stepwise Selection: Step 1
Variable x2 Entered: R-Square = 0.6570 and C(p) = 14.8229
Analysis of Variance
Sum of Mean
Source DF Squares Square F Value Pr > F
Model 1 17657609 17657609 11.49 0.0147
Error 6 9217391 1536232
Corrected Total 7 26875000
Parameter Standard
Variable Estimate Error Type II SS F Value Pr > F
Intercept 88609 1613.97489 4630372352 3014.11 <.0001
x2 1.65217 0.48732 17657609 11.49 0.0147
Bounds on condition number: 1, 1
-----------------------------------------------------------------------------------------
-------------
Stepwise Selection: Step 2
Variable x1 Entered: R-Square = 0.9089 and C(p) = 3.0000
Analysis of Variance
Sum of Mean
Source DF Squares Square F Value Pr > F
Model 2 24426549 12213274 24.94 0.0025
Error 5 2448451 489690
Corrected Total 7 26875000
Parameter Standard
Variable Estimate Error Type II SS F Value Pr > F
Intercept 83212 1713.94613 1154236984 2357.08 <.0001
x1 1.29846 0.34924
6768940 13.82 0.0137
x2 2.33716 0.33113 24395487 49.82 0.0009
The SAS System 12:43 Tuesday, May 13, 2013 2
The REG Procedure
Model:
MODEL1
Dependent Variable: y
Stepwise Selection: Step 2
Bounds on condition number: 1.4484, 5.7936
-----------------------------------------------------------------------------------------
-------------
All variables left in the model are significant at
the 0.1500 level.
All variables have been entered into the model.
Summary of Stepwise Selection
Variable Variable Number Partial Model
Step Entered Removed Vars In R-Square R-Square C(p) F Value Pr > F
1 x
2 1 0.6570 0.6570 14.8229 11.49 0.0147 2 x1 2 0.2519 0.9089 3.0000 13.82 0.0137
The SAS System 12:43 Tuesday, May 13, 2013 3
The REG Procedure
Model:
MODEL1
Dependent Variable: y
Analysis of Variance
Sum of Mean
Source DF Squares Square F Value Pr > F
Model 2 24426549 12213274 24.94 0.0025
Error 5 2448451 489690
Corrected Total 7 26875000
Root MSE 699.77873 R-Square 0.9089
Dependent Mean 93875 Adj R-Sq 0.8725
Coeff Var 0.74544
Parameter Estimates
Parameter Standard Variance
Variable DF Estimate Error t Value Pr > |t| Tolerance Inflation
Intercept 1 83212 1713.94613 48.55 <.0001 . 0
x1 1 1.29846 0.34924 3.72 0.0137 0.69042 1.44840
x2 1 2.33716 0.33113 7.06 0.0009 0.69042 1.44840
Collinearity Diagnostics
Condition
---------Proportion of Variation---------
Number Eigenvalue Index Intercept x1 x2
1 2.84648 1.00000 0.00255 0.00833 0.00587
2 0.13997 4.50960 0.00054471 0.28540 0.16395
3 0.01355 14.49360 0.99691 0.70627 0.83018
The SAS System 12:43 Tuesday, May 13, 2013 4
The REG Procedure
Model:
MODEL1
Dependent Variable: y
Output Statistics
Dep Var Predicted Std Error Std Error Student Cook's
Obs y Value Mean Predict Residual Residual Residual -2-1 0 1 2 D
1 96000 96845 556.7261 -845.1014 424.0 -1.993 | ***| | 2.284
2 95000 94508 384.1844 492.058
3 584.9 0.841 | |* | 0.102
3 95000 94508 358.017
4 491.9861 601.3 0.818 | |* | 0.079
4 94000 94508 568.6482 -508.0500 407.8 -1.246 | **| | 1.006
5 90000 90483 562.0822 -482.8532 416.8 -1.158 | **| | 0.813
6 92000 92301 333.0166 -300.6642 615.5 -0.489 | | | 0.023
7 95000 94378 261.9475 621.8685 648.9 0.958 | |* | 0.050
8 94000 93469 254.0453 530.7559 652.0 0.814 | |* | 0.034
Sum of Residuals 0
Sum of Squared Residuals
2448451
Predicted Residual SS (PRESS) 11377963
解:(1)由结果可知:每周总收入Y与电视广告的费用X1 和报纸广告的费用X2 的回归关系式为:
Y=83212+1.29846X1+ 2.33716X2, 在显著性水平为0.02的条件下, P1=0.0147<0.02,P2=0.009<0.02,认为电视广告的费用与报纸广告的
费用和每周的总收入有显著关系。

(2)因为在CooK’s D中出现了CooK’s的值大于0.5的情况,所以有可疑点,有强影响点。

(3)模型的决定系数为0.9089,均方差MSE为489690,均方根误差为699.77873.
(4)电视广告费用X1=3500元,报纸广告费用为2000元,则该周的总收入为Y=92431.
练习题4
程序:
data L1;
input x y@@;
cards;
2 106.42
3 108.20
4 109.58
5 109.50
7 110.00
8 109.93
10 110.49
11 110.59
14 110.60
15 110.90
16 110.76
18 111.00
19 111.20
proc reg;
model y=x/cli clm clb;
run;
结果:
The SAS System 15:40 Tuesday, May 13, 2013 1
The REG Procedure
Model:
MODEL1
Dependent Variable: y
Analysis of Variance
Sum of Mean
Source DF Squares Square F Value Pr > F
Model 1 14.61416 14.61416 24.37 0.0004
Error 11 6.59635 0.59967
Corrected Total 12 21.21051
Root MSE 0.77438 R-Square 0.6890
Dependent Mean 109.93615 Adj R-Sq 0.6607
Coeff Var 0.70439
Parameter Estimates
Parameter Standard Variable DF Estimate Error t Value Pr > |t| 95% Confidence Limits
Intercept 1 108.01842 0.44389 243.35 <.0001 107.04143 108.99541
x 1 0.18887 0.03826 4.94 0.0004 0.10466 0.27307
The SAS System 15:40 Tuesday, May 13, 2013 2
The REG Procedure
Model:
MODEL1
Dependent Variable: y
Output Statistics
Dep Var Predicted Std Error
Obs y Value Mean Predict 95% CL Mean 95% CL Predict Residual
1 106.4200 108.396
2 0.3787 107.5626 109.2298 106.4988 110.2935 -1.9762
2 108.2000 108.5850 0.3479 107.819
3 109.3508 106.7165 110.4535 -0.3850
3 109.5800 108.7739 0.3187 108.0725 109.4753 106.9308 110.6170 0.8061
4 109.5000 108.9628 0.2916 108.3210 109.604
5 107.1415 110.7840 0.5372
5 110.0000 109.3405 0.2463 108.7983 109.8827 107.5519 111.1291 0.6595
6 109.9300 109.5294 0.2300 109.0230 110.035
7 107.7513 111.3074 0.4006
7 110.4900 109.9071 0.2149 109.4342 110.3800 108.1383 111.6759 0.5829
8 110.5900 110.0960 0.2172 109.6179 110.5740 108.3258 111.8661 0.4940
9 110.6000 110.6626 0.2603 110.0895 111.2356 108.8644 112.4607 -0.0626
10 110.9000 110.8514 0.2837 110.2269 111.4759 109.0362 112.6666 0.0486
11 110.7600 111.0403 0.3101 110.3578 111.7228 109.2043 112.8763 -0.2803
12 111.0000 111.4180 0.3691 110.6056 112.2304 109.5299 113.3062 -0.4180
13 111.2000 111.6069 0.4008 110.7247 112.4891 109.6877 113.5261 -0.4069
Sum of Residuals 0
Sum of Squared Residuals 6.59635
Predicted Residual SS (PRESS) 10.45223
结果分析:y与x是直线关系。

回归系数为a=108.01842, b=0.18887. 回归方程为y= 108.01842+ 0.18887x.。

相关文档
最新文档