proc reg data=gakusei; : 回帰分析 model taijyuu=shintyou kyoui; : 複数変量を指定 output out=outreg1 predicted=pred1 residual=resid1; : 結果項目の保存 run; : proc print data=outreg1(obs=15); run;
proc princomp data=gakusei out=outprin; : 相関係数を使って var shintyou taijyuu kyoui; : run; : proc print data=outprin(obs=15); run;
proc factor data=food; : オプションを付けないと主成分分析 var X01-X10; : 解析に使う変量リスト run; :
proc glm data=polymer; class A; model Y = A; means A / tukey; run;
proc means data=dragons; : 平均値等を算出 run; proc freq data=dragons; : 頻度を算出。個々&クロス集計 table DoBY DoBM tou da tou*da; run; proc chart data=dragons; : ヒストグラムを描く hbar shintyou; : 水平棒グラフ。変量を指定(複数指定も可)。 vbar shintyou; : 垂直棒グラフ。変量を指定(複数指定も可)。 hbar DoBY; vbar DoBY; run; proc univariate data=dragons plot; : 基礎統計量の算出。plot オプションを指定。 var shintyou; : 指定した変量について run; ods listing; : グラフをキャラクタープロットで出力する場合 ods graphics off; : proc univariate data=dragons plot; var shintyou; run; proc corr data=dragons; : 相関係数の算出 var shintyou taijyuu; run;
/* Lesson 15-01 */
/* File Name = les1501.sas 01/28/20 */
options nocenter linesize=78 pagesize=30;
options locale='en_US';
/* options locale='ja_JP'; */
proc printto print = 'Kougi19/les1501-Results.txt' new;
title "Sashelp.iris --- Fisher's Iris Data (1936)";
proc contents data=sashelp.iris varnum; : データの変量情報を表示する
ods select position; : データの指定方法にも注目
run;
title "The First Five Observations Out of 150";
proc print data=sashelp.iris(obs=5) noobs; : 先頭5サンプルを表示
run;
title "The Species Variable";
proc freq data=sashelp.iris; : 頻度集計
tables Species;
run;
proc fastclus data=sashelp.iris out=outclust maxclusters=3; : クラスター分析
var SepalLength SepalWidth PetalLength PetalWidth;
run;
proc plot data=outclust;
plot SepalLength*SepalWidth=cluster;
plot SepalLength*PetalLength=cluster;
plot SepalLength*PetalWidth=cluster;
plot SepalWidth*PetalLength=cluster;
plot SepalWidth*PetalWidth=cluster;
plot PetalLength*PetalWidth=cluster;
run;
title "Scatterplot Matrix for Iris Data";
proc sgscatter data=sashelp.iris; : [おまけ1] 散布図行列
matrix SepalLength SepalWidth PetalLength PetalWidth
/ group=Species;
run;
title "Scatterplot Matrix with histogram for Iris Data";
proc sgscatter data=sashelp.iris; : [おまけ2] ヒストグラム付き散布図行列
matrix SepalLength SepalWidth PetalLength PetalWidth
/ group=Species diagonal=(kernel histogram);
run;
title;
Sashelp.iris --- Fisher's Iris Data (1936) 62
Thursday, January 16, 2020 05:45:10 PM
The CONTENTS Procedure
Variables in Creation Order
# Variable Type Len Label
1 Species Char 10 Iris Species
2 SepalLength Num 8 Sepal Length (mm)
3 SepalWidth Num 8 Sepal Width (mm)
4 PetalLength Num 8 Petal Length (mm)
5 PetalWidth Num 8 Petal Width (mm)
The First Five Observations Out of 150 63
Thursday, January 16, 2020 05:45:10 PM
Sepal Sepal Petal Petal
Species Length Width Length Width
Setosa 50 33 14 2
Setosa 46 34 14 3
Setosa 46 36 10 2
Setosa 51 33 17 5
Setosa 55 35 13 2
The Species Variable Thursday, January 16, 2020 05:45:10 PM 64
The FREQ Procedure
Iris Species
Cumulative Cumulative
Species Frequency Percent Frequency Percent
---------------------------------------------------------------
Setosa 50 33.33 50 33.33
Versicolor 50 33.33 100 66.67
Virginica 50 33.33 150 100.00
The Species Variable Thursday, January 16, 2020 05:45:10 PM 65
The FASTCLUS Procedure
Replace=FULL Radius=0 Maxclusters=3 Maxiter=1
Initial Seeds
Cluster SepalLength SepalWidth PetalLength PetalWidth
---------------------------------------------------------------------------
1 77.00000000 38.00000000 67.00000000 22.00000000
2 57.00000000 44.00000000 15.00000000 4.00000000
3 49.00000000 25.00000000 45.00000000 17.00000000
Criterion Based on Final Seeds = 3.7097
Cluster Summary
Maximum Distance
RMS Std from Seed Radius Nearest
Cluster Frequency Deviation to Observation Exceeded Cluster
-----------------------------------------------------------------------------
1 33 3.8831 12.9226 3
2 50 2.7803 12.4803 3
3 67 4.1797 18.5320 1
The Species Variable Thursday, January 16, 2020 05:45:10 PM 66
The FASTCLUS Procedure
Replace=FULL Radius=0 Maxclusters=3 Maxiter=1
Cluster Summary
Distance Between
Cluster Cluster Centroids
-----------------------------
1 18.3409
2 34.2516
3 18.3409
Statistics for Variables
Variable Total STD Within STD R-Square RSQ/(1-RSQ)
---------------------------------------------------------------------
SepalLength 8.28066 4.48242 0.710915 2.459187
SepalWidth 4.35866 3.24819 0.452092 0.825123
PetalLength 17.65298 4.29764 0.941527 16.101961
PetalWidth 7.62238 2.38707 0.903243 9.335201
OVER-ALL 10.69224 3.70171 0.881751 7.456709
Pseudo F Statistic = 548.07
The Species Variable Thursday, January 16, 2020 05:45:10 PM 67
The FASTCLUS Procedure
Replace=FULL Radius=0 Maxclusters=3 Maxiter=1
Approximate Expected Over-All R-Squared = 0.62728
Cubic Clustering Criterion = 24.559
WARNING: The two values above are invalid for correlated variables.
Cluster Means
Cluster SepalLength SepalWidth PetalLength PetalWidth
---------------------------------------------------------------------------
1 69.00000000 30.96969697 58.27272727 21.27272727
2 50.06000000 34.28000000 14.62000000 2.46000000
3 59.47761194 27.61194030 44.52238806 14.53731343
Cluster Standard Deviations
Cluster SepalLength SepalWidth PetalLength PetalWidth
---------------------------------------------------------------------------
1 5.012484414 2.909948974 4.577613511 2.401467354
2 3.524896872 3.790643691 1.736639965 1.053855894
3 4.831582365 2.953966126 5.360795421 3.011736428
The Species Variable Thursday, January 16, 2020 05:45:10 PM 68
Plot of SepalLength*SepalWidth. Symbol is value of CLUSTER.
|
S |
e 84 +
p |
a | 1 1 1 1
l | 1 1
72 + 1 1 1 1
L | 3 1 3 3
e | 1 3 3 3 3 3 1
n | 3 3 3 3 1 3 1 3 3 1
g 60 + 3 3 3 3 3 3 3 3
t | 3 3 3 3 3 3 2 2 2
h | 3 3 3 3 3 2 2 2 2 2
|3 3 3 3 2 2 2 2 2 2 2 2 2
( 48 + 3 3 2 2 2 2 2
m | 2 2 2 2 2 2 2
m | 2
) |
36 +
|
-+-------------+-------------+-------------+-------------+-------------+-
20 25 30 35 40 45
Sepal Width (mm)
NOTE: 64 obs hidden.
The Species Variable Thursday, January 16, 2020 05:45:10 PM 69
Plot of SepalLength*PetalLength. Symbol is value of CLUSTER.
|
S |
e 84 +
p |
a | 1 1 1 1
l | 1 1
72 + 1111 1
L | 333 1 11 1 1
e | 3 33 331 1111
n | 333 33333 1111 1
g 60 + 3 3 3333333 3
t | 2 2 2 33 3333 3 333
h | 222 2 33 3 33
| 222222 2 3 3 3 3
( 48 + 2222 2 3 3
m | 2 222
m | 2
) |
36 +
|
---+---------+---------+---------+---------+---------+---------+--
10 20 30 40 50 60 70
Petal Length (mm)
NOTE: 53 obs hidden.
The Species Variable Thursday, January 16, 2020 05:45:10 PM 70
Plot of SepalLength*PetalWidth. Symbol is value of CLUSTER.
|
S |
e 84 +
p |
a | 1 1 1
l | 1 1
72 + 1 1 1 1
L | 3 3 1 1
e | 3 3 3 3 1 1 1 1 1 1 1
n | 3 3 3 3 3 1 1 1 1 1
g 60 + 3 3 3 3 3 3 3
t | 2 2 2 3 3 3 3 3 3 3 3
h | 2 2 3 3 3 3 3
| 2 2 2 2 2 2 3 3 3
( 48 + 2 2 2 3 3
m | 2 2
m | 2
) |
36 +
|
---+---------+---------+---------+---------+---------+--
0 5 10 15 20 25
Petal Width (mm)
NOTE: 74 obs hidden.
The Species Variable Thursday, January 16, 2020 05:45:10 PM 71
Plot of SepalWidth*PetalLength. Symbol is value of CLUSTER.
|
50 +
S |
e |
p |
a | 2
l | 22
40 + 2
W | 2 222 2 1 1
i | 2 22 1
d | 2222
t | 2222 2 3 3 1 11 1
h | 22222 33 333 1 11111 11
30 + 2 22 2 33 333 33331 1 11 1 1
( | 2 3 3333 33333 3 1 1 1 1
m | 3 3333 3 3 3 3 3 1
m | 3 33 3 33 1
) | 2 3 33 3 3
| 3 3 3
20 + 3
---+---------+---------+---------+---------+---------+---------+--
10 20 30 40 50 60 70
Petal Length (mm)
NOTE: 39 obs hidden.
The Species Variable Thursday, January 16, 2020 05:45:10 PM 72
Plot of SepalWidth*PetalWidth. Symbol is value of CLUSTER.
|
50 +
S |
e |
p |
a | 2
l | 2 2
40 + 2
W | 2 2 2 1 1
i | 2 2 2 1
d | 2 2 2
t | 2 2 2 2 3 1 1 1 1
h | 2 2 3 3 3 3 1 1 1
30 + 2 2 2 3 3 3 3 1 3 1 1 1 1 1
( | 2 3 3 3 3 3 1 1 1 1 3
m | 3 3 3 3 3 3 3 1
m | 3 3 3 3 1 3 3
) | 2 3 3 3
| 3 3
20 + 3
---+---------+---------+---------+---------+---------+--
0 5 10 15 20 25
Petal Width (mm)
NOTE: 69 obs hidden.
The Species Variable Thursday, January 16, 2020 05:45:10 PM 73
Plot of PetalLength*PetalWidth. Symbol is value of CLUSTER.
|
P 72 +
e | 1 1 1 1
t | 1 1
a 60 + 1 1 1 1 1 1 1
l | 3 1 1 1 1 1 1
| 3 3 3 3 3 1 1 3
L 48 + 3 3 3 3 3 3 3
e | 3 3 3 3 3 3
n | 3 3 3 3 3
g 36 + 3 3
t | 3 3
h |
24 +
( | 2 2
m | 2 2 2 2 2 2
m 12 + 2 2 2 2
) |
|
0 +
---+---------+---------+---------+---------+---------+--
0 5 10 15 20 25
Petal Width (mm)
NOTE: 88 obs hidden.
皆さんのご期待にどこまで応えられか心許無い部分もありますが、 Q3、Q4を通して15回の講義、お疲れ様でした。 ご健康には留意されてお過ごしください。お元気で。