/* Lesson 13-1 */ /* File Name = les1301.sas 10/12/00 */ data gakusei; infile 'all00.prn'; input seibetsu $ height weight chest jitaku $ kodukai; proc print data=gakusei(obs=10); run; proc reg data=gakusei; : 回帰分析 model weight=height chest; : 複数変量を指定 output out=outreg1 predicted=pred1 residual=resid1; : 結果項目の保存 run; : proc print data=outreg1(obs=15); run; proc plot data=outreg1; : 散布図を描く where weight^=. and height^=. and chest^=.; : 解析に使ったデータのみ plot weight*height; : plot weight*chest; : plot pred1*weight; : 予測値と観測値 plot resid1*pred1; : 残差と予測値(残差解析) plot resid1*height; : 残差と説明変量(残差解析) plot resid1*chest; : 残差と説明変量(残差解析) plot resid1*weight; : 残差と目的変量(残差解析) run; :
SAS システム 2
22:17 Tuesday, October 10, 2000
Model: MODEL1
Dependent Variable: WEIGHT
Analysis of Variance
Sum of Mean
Source DF Squares Square F Value Prob>F
Model 2 2009.97551 1004.98776 27.250 0.0001
Error 49 1807.10507 36.87970
C Total 51 3817.08058
Root MSE 6.07287 R-square 0.5266
Dep Mean 62.13654 Adj R-sq 0.5073
C.V. 9.77342
SAS システム 3
22:17 Tuesday, October 10, 2000
Parameter Estimates
Parameter Standard T for H0:
Variable DF Estimate Error Parameter=0 Prob > |T|
INTERCEP 1 -97.557924 23.41228656 -4.167 0.0001
HEIGHT 1 0.538507 0.12801336 4.207 0.0001
CHEST 1 0.763243 0.14488888 5.268 0.0001
SAS システム 4
22:17 Tuesday, October 10, 2000
OBS SEIBETSU HEIGHT WEIGHT CHEST JITAKU KODUKAI PRED1 RESID1
1 F 145.0 38 . J 10000 . .
2 F 148.0 42 . J 50000 . .
3 F 148.9 . . J 60000 . .
4 F 154.0 46 . . . .
5 F 155.0 . . J 20000 . .
6 F 156.0 49 85 J 25000 51.3248 -2.32479
7 M 156.0 61 90 J 0 55.1410 5.85899
8 F 156.0 . . J 30000 . .
9 F 156.0 . . J 50000 . .
10 F 156.0 . . G . . .
11 F 156.5 . . J 20000 . .
12 F 157.0 43 . J 20000 . .
13 F 158.0 49 85 J 0 52.4018 -3.40180
14 F 159.0 49 88 J 30000 55.2300 -6.23004
15 F 159.0 52 . J 50000 . .
SAS システム 5
22:17 Tuesday, October 10, 2000
プロット : WEIGHT*HEIGHT. 凡例: A = 1 OBS, B = 2 OBS, ...
WEIGHT
88 + A
|
80 + A A
| A A
72 + A B A A A
| A A
64 + A A B C A B AA B
| A A A C A A A A A A
56 + A A A
| A A A A A
48 + A A A B
--+---------+---------+---------+---------+---------+---------+--
155 160 165 170 175 180 185
HEIGHT
SAS システム 6
22:17 Tuesday, October 10, 2000
プロット : WEIGHT*CHEST. 凡例: A = 1 OBS, B = 2 OBS, ...
WEIGHT
88 + A
|
80 + A A
| A A
72 + BB A A
| A A
64 + A C AAD AB A
| B A B B D A
56 + A A A
| A BA A
48 + B B A
---+-----------+-----------+-----------+-----------+--
70 80 90 100 110
CHEST
SAS システム 7
22:17 Tuesday, October 10, 2000
プロット : PRED1*WEIGHT. 凡例: A = 1 OBS, B = 2 OBS, ...
PRED1 |
100 +
|
|
80 + A
| A B A
| CABAAC B A A
60 + A AA A F CA B AA A A
| BCABA A AA
|
40 +
---+---------+---------+---------+---------+---------+--
40 50 60 70 80 90
WEIGHT
SAS システム 8
22:17 Tuesday, October 10, 2000
プロット : RESID1*PRED1. 凡例: A = 1 OBS, B = 2 OBS, ...
|
R 40 +
e |
s |
i 20 + A
d | A
u | A A A A A BAA A A
a 0 + A A A AAA BACBA B A A AA
l | A BBAA B AA ABB A A
|
-20 +
---+------------+------------+------------+------------+--
50 60 70 80 90
Predicted Value of WEIGHT
SAS システム 9
22:17 Tuesday, October 10, 2000
プロット : RESID1*HEIGHT. 凡例: A = 1 OBS, B = 2 OBS, ...
|
R 40 +
e |
s |
i 20 + A
d | A
u | A B B A A B A A
a 0 + A A A A A D A B B AB A A A A
l | A A A A A B B A A A A A AA A A
|
-20 +
---+---------+---------+---------+---------+---------+---------+--
155 160 165 170 175 180 185
HEIGHT
SAS システム 10
22:17 Tuesday, October 10, 2000
プロット : RESID1*CHEST. 凡例: A = 1 OBS, B = 2 OBS, ...
|
R 40 +
e |
s |
i 20 + A
d | A
u | A A B BC AA
a 0 + B A A BAAC AF AA A
l | C C AA BB AA AA A A
|
-20 +
---+------------+------------+------------+------------+--
70 80 90 100 110
CHEST
SAS システム 11
22:17 Tuesday, October 10, 2000
プロット : RESID1*WEIGHT. 凡例: A = 1 OBS, B = 2 OBS, ...
|
R 40 +
e |
s |
i 20 + A
d | A
u | A AA B AB A AA
a 0 + A AA A FACA C AB
l | BBAA A AA C BAA A A
|
-20 +
---+---------+---------+---------+---------+---------+--
40 50 60 70 80 90
WEIGHT
/* Lesson 13-2 */
/* File Name = les1302.sas 10/12/00 */
data gakusei;
infile 'all00.prn';
input seibetsu $ height weight chest jitaku $ kodukai;
proc print data=gakusei(obs=10);
run;
proc corr data=gakusei; : 相関係数
where seibetsu='M'; : 男性について
run; :
:
proc reg data=gakusei; : 回帰分析
where seibetsu='M'; : 男性について
model weight=height chest; :
output out=outreg1 predicted=pred1 residual=resid1; :
run; :
proc print data=outreg1(obs=15);
run;
proc plot data=outreg1;
where seibetsu='M' and weight^=. and height^=. and chest^=.; : 対象データについて
plot weight*height;
plot weight*chest;
plot pred1*weight;
plot resid1*pred1;
plot resid1*height;
plot resid1*chest;
plot resid1*weight;
run;
《 略 》