proc reg data=gakusei; model weight=height chest; where seibetsu='M' and weight<85; 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^=. and weight<85; plot weight*chest; plot weight*pred1; plot resid1*pred1; plot resid1*height; plot resid1*chest; plot resid1*weight; run; proc univariate data=outreg1 plot normal; where seibetsu='M' and weight^=. and height^=. and chest^=. and weight<85; var resid1; var weight height chest; run;
SAS システム 14
22:01 Wednesday, July 25, 2001
Univariate Procedure
Variable=RESID1 Residual
Moments
N 50 Sum Wgts 50
Mean 0 Sum 0
Std Dev 4.87017 Variance 23.71856
Skewness 0.2674 Kurtosis -0.43989
USS 1162.209 CSS 1162.209
CV . Std Mean 0.688746
T:Mean=0 0 Pr>|T| 1.0000
Num ^= 0 50 Num > 0 20
M(Sign) -5 Pr>=|M| 0.2026
Sgn Rank -23.5 Pr>=|S| 0.8232
W:Normal 0.973067 Pr< W 0.4749
SAS システム 15
22:01 Wednesday, July 25, 2001
Univariate Procedure
Variable=RESID1 Residual
Quantiles(Def=5)
100% Max 10.52045 99% 10.52045
75% Q3 3.839371 95% 9.379677
50% Med -0.56758 90% 6.81807
25% Q1 -3.26226 10% -5.58025
0% Min -10.3023 5% -7.37855
1% -10.3023
Range 20.8227
Q3-Q1 7.101633
Mode -10.3023
SAS システム 16
22:01 Wednesday, July 25, 2001
Univariate Procedure
Variable=RESID1 Residual
Extremes
Lowest Obs Highest Obs
-10.3023( 3) 7.014686( 11)
-8.57845( 45) 8.258674( 31)
-7.37855( 24) 9.379677( 40)
-6.44154( 47) 9.38763( 38)
-6.22982( 4) 10.52045( 23)
SAS システム 17
22:01 Wednesday, July 25, 2001
Univariate Procedure
Variable=RESID1 Residual
Stem Leaf # Boxplot
1 1 1 |
0 5556677899 10 |
0 222222344 9 +--+--+
-0 443333333222111100000 21 *-----*
-0 97665555 8 |
-1 0 1 |
----+----+----+----+-
Multiply Stem.Leaf by 10**+1
SAS システム 18
22:01 Wednesday, July 25, 2001
Univariate Procedure
Variable=RESID1 Residual
Normal Probability Plot
12.5+ +*+++
| ****+**+*++
| +++*******+
| ***************
| ++*+**+*++
-12.5++++*+
+----+----+----+----+----+----+----+----+----+----+
-2 -1 0 +1 +2
つまり、極端な言い方をすれば、
[平均」─ 3x[標準偏差] 〜 [平均]+ 3x[標準偏差] の範囲に
ほとんどのデータが存在しているということが言えるのです。
ただし、この前提条件も、「分布が正規分布なら」です。
標準偏差が判れば、データがおおよそどの範囲に散らばっているかが判るので、
データの形状を把握する上で重宝する指標であると言えます。
data gakusei; infile 'all01.prn'; input seibetsu $ height weight chest jitaku $ kodukai; dekasa=height+weight+chest; : 変量間の加減乗除 ch_2=chest**2; : 二乗 ch_sr=sqrt(chest); : ルート
[算術演算子]
[数値関数]
data rei02;
infile 'seito.prn';
input id $ sex $ kesseki $
koku $ suu1 $ suu2 $ tireki $ koumin $ rika $;
if sex^='M' then delete; /* male only */
if kesseki^='0' then delete; /* syusseki-sya only */
if tireki="世界史-0" then tireki="世界史";
if tireki="世界史-2" then tireki="世界史";
if tireki="日本史-2" then tireki="日本史";
if tireki="日本史-3" then tireki="日本史";
...
[例3] 複数の処理をさせたい場合
if tireki="世界史-0" then do;
tireki="世界史";
koumin=.;
end;
...
[比較演算子]
[論理演算子]