/* Lesson 13-1 */
/* File Name = les1301.sas 07/12/16 */
data gakusei;
infile 'all07ae.prn'
firstobs=2;
input sex $ shintyou taijyuu kyoui
jitaku $ kodukai carryer $ tsuuwa;
proc print data=gakusei(obs=10);
run;
proc plot data=gakusei; : 散布図
plot shintyou*taijyuu; : 元の変量のプロット
run; :
proc princomp cov data=gakusei out=outprin; : 主成分分析(分散共分散行列)
var shintyou taijyuu; : 2変量
run; :
proc print data=outprin(obs=15); : 結果の出力
run; :
proc plot data=outprin; : 散布図
plot prin2*prin1/vref=0 href=0; : 主成分得点のプロット
run; :
: 参考までに、
proc sort data=outprin; : 説明のためにソートしてみる
by prin1; : 第一主成分で
run; :
proc print data=outprin; : 体重がややが効いていることの確認
run; :
SAS システム 2 10:30 Monday, July 9, 2016 プロット : SHINTYOU*TAIJYUU. 凡例: A = 1 OBS, B = 2 OBS, ... (NOTE: 49 オブザベーションが欠損値です.) SHINTYOU | 200 + | | A B A A 180 + A BFCFDEBGA B B A A A | CAHELIVQLHDHEDB BC A | AGAGJJGFCCDEAA AA A A 160 + ADEHDIFDBACB | A ECBEDDA A A | A BAA 140 + ---+-----------+-----------+-----------+-----------+-- 20 40 60 80 100 TAIJYUU SAS システム 3 10:30 Monday, July 9, 2016 Principal Component Analysis 326 Observations 2 Variables Simple Statistics SHINTYOU TAIJYUU Mean 168.6926380 58.78466258 StD 8.0313352 9.33278478 SAS システム 4 10:30 Monday, July 9, 2016 Principal Component Analysis Covariance Matrix SHINTYOU TAIJYUU SHINTYOU 64.50234563 52.81268674 TAIJYUU 52.81268674 87.10087173 Total Variance = 151.60321737 Eigenvalues of the Covariance Matrix Eigenvalue Difference Proportion Cumulative PRIN1 129.810 108.016 0.856245 0.85625 PRIN2 21.794 . 0.143755 1.00000 SAS システム 5 10:30 Monday, July 9, 2016 Principal Component Analysis Eigenvectors PRIN1 PRIN2 SHINTYOU 0.628802 0.777565 TAIJYUU 0.777565 -.628802 SAS システム 6 10:30 Monday, July 9, 2016 S H T K C I A J O A T N I K I D R S P P T J Y T U R U R R O S Y Y O A K Y U I I B E O U U K A E W N N S X U U I U I R A 1 2 1 F 145.0 38.0 . J 10000 . -31.0594 -5.35312 2 F 146.7 41.0 85 J 10000 Vodafone 6000 -27.6578 -5.91767 3 F 148.0 42.0 . J 50000 . -26.0627 -5.53564 4 F 148.0 43.0 80 J 50000 DoCoMo 4000 -25.2852 -6.16444 5 F 148.9 . . J 60000 . . . 6 F 149.0 45.0 . G 60000 . -23.1013 -6.64448 7 F 150.0 46.0 86 40000 . -21.6949 -6.49572 8 F 151.0 45.0 . J 20000 docomo 5000 -21.8436 -5.08935 9 F 151.0 50.0 . G 60000 J-PHONE . -17.9558 -8.23336 10 F 151.7 41.5 80 J 35000 . -24.1250 -2.34424 11 F 152.0 35.0 77 J 60000 DoCoMo 2000 -28.9905 1.97624 12 F 152.0 43.0 . J 20000 au 3500 -22.7700 -3.05418 13 F 152.0 44.0 . 45000 DoCoMo 4000 -21.9924 -3.68298 14 F 153.0 41.0 . J 125000 No . -23.6963 -1.01901 15 F 153.0 42.0 . G 0 Vodafone 1000 -22.9187 -1.64781 SAS システム 8 10:30 Monday, July 9, 2016 プロット : PRIN2*PRIN1. 凡例: A = 1 OBS, B = 2 OBS, ... (NOTE: 49 オブザベーションが欠損値です.) 20 + | | | PRIN2 | A | A | BB DACBBACCAA B | C GBAFCCFHDFFHCBED A A 0 +---------A---BBBBDAFCAJ-CHFGFEHNDACGC-G-AA-----A--------- | A AAAABBACECAADCB C CBCDDBCEE A AA | AAA AA A A B B|BA A A AAB A | A | AA A A | | A A -20 + | A A ---+------------+------------+------------+------------+-- -40 -20 0 20 40 PRIN1 SAS システム 9 10:30 Monday, July 9, 2016 OBS SEX SHINTYOU TAIJYUU KYOUI JITAKU KODUKAI CARRYER TSUUWA PRIN1 PRIN2 1 F 148.9 . . J 60000 . . . 2 F 153.0 . . G 120000 DoCoMo 200 . . 3 F 153.0 . . 50000 5000 . . ≪中略≫ SAS システム 47 10:30 Monday, July 9, 2016 S H T K C I A J O A T N I K I D R S P P T J Y T U R U R R O S Y Y O A K Y U I I B E O U U K A E W N N S X U U I U I R A 1 2 312 M 171.0 70 89 J 60000 . 10.1715 -5.25811 313 M 176.0 66 . G 100000 docomo 5500 10.2053 1.14493 314 M 179.9 63 . J 30000 . 10.3249 6.06384 315 M 175.0 67 . J 45000 . 10.3540 -0.26144 316 M 174.0 68 . G 0 9000 10.5028 -1.66781 317 M 173.0 69 . J 60000 au 9000 10.6516 -3.07417 318 M 183.0 61 . J 100000 . 10.7191 9.73190 319 M 172.0 70 90 J 30000 . 10.8003 -4.48054 320 M 172.0 70.0 . J 20000 . 10.8003 -4.4805 321 M 177.0 66.0 87 G 40000 DoCoMo 6000 10.8341 1.9225 322 M 171.0 71.0 . G 160000 . 10.9491 -5.8869 323 M 176.0 67.0 83 G 0 . 10.9828 0.5161 324 M 181.0 63.0 . J 0 au 4000 11.0166 6.9192 325 M 175.0 68.0 80 150000 au 15000 11.1316 -0.8902 326 M 175.0 68.0 . J 0 DoCoMo 20000 11.1316 -0.8902 327 M 180.0 64.0 90 J 35000 . 11.1654 5.5128 328 M 180.0 64.0 90 G 60000 au 10000 11.1654 5.5128 329 M 179.0 65.0 . J 0 . 11.3141 4.1064 330 M 168.0 74.0 . G 120000 DDIp 15000 11.3954 -10.1060 331 M 178.0 66.0 95 J 30000 au 3000 11.4629 2.7001 332 M 177.0 67.0 . 4000 DoCoMo 8000 11.6116 1.2937 333 M 173.8 69.6 90 J 30000 DoCoMo 13000 11.6212 -2.8294 334 M 180.0 65.0 88 J 30000 . 11.9429 4.8840 335 M 180.0 65.0 . G 100000 . 11.9429 4.8840 336 M 179.0 66 . 30000 . 12.0917 3.4776 337 M 168.0 75 . G 150000 . 12.1729 -10.7348 338 M 173.0 71 100 G 0 . 12.2067 -4.3318 339 M 178.0 67 . J 0 . 12.2405 2.0713 340 M 172.0 72 89 G 150000 . 12.3555 -5.7381 341 M 172.0 72 . G 60000 au 3500 12.3555 -5.7381 342 M 177.0 68 . G 80000 . 12.3892 0.6649 343 M 182.0 64 . G 0 . 12.4230 7.0679 344 M 165.0 78.0 . G 0 2098 12.6192 -14.9539 345 M 170.0 74.0 90 J 0 . 12.6530 -8.5509 346 M 175.0 70.0 95 G 50000 8000 12.6867 -2.1478 347 M 178.0 68.0 . J 100000 DoCoMo 4000 13.0180 1.4425 348 M 184.0 65.0 . G 140000 au 10000 14.4581 7.9943 349 M 170.0 78.0 . 45000 Vodafon 10000 15.7632 -11.0661 350 M 179.9 70.0 . J 15000 DoCoMo 700 15.7679 1.6622 351 M 175.0 74.0 . J 0 . 15.7970 -4.6631 352 M 180.0 70.0 94 G 70000 au 5000 15.8308 1.73998 353 M 180.0 70.0 . J 40000 au 4000 15.8308 1.73998 354 M 180.0 70.0 . . . 15.8308 1.73998 355 M 180.0 70.0 . J 40000 DoCoMo 6500 15.8308 1.73998 356 M 180.0 70.0 . 5000 3000 15.8308 1.73998 357 M 178.7 71.2 95 0 . 15.9464 -0.02542 358 M 184.0 68.0 85 30000 . 16.7908 6.10784 359 M 173.5 76.5 . G 100000 . 16.7977 -7.40141 360 M 182.0 70.0 90 G 100000 . 17.0884 3.2951 361 M 185.0 68.0 93 J 0 . 17.4196 6.8854 362 M 175.0 77.0 95 G 130000 . 18.1297 -6.5495 363 M 179.1 74.2 . 0 au 4000 18.5306 -1.6008 364 M 175.0 79.0 . J 0 No 0 19.6848 -7.8071 365 M 176.5 78.0 96 J 10000 . 19.8505 -6.0119 366 M 177.0 78.0 . J 40000 . 20.1649 -5.6231 367 M 181.5 74.5 . G 120000 au 3000 20.2730 0.0767 368 M 185.0 72.0 . J 30000 7000 20.5299 4.3702 369 M 178.0 78.0 110 G 50000 . 20.7937 -4.8456 370 M 173.0 84.0 46 G 350000 . 22.3150 -12.5062 371 M 169.3 88.5 94 J 0 . 23.4875 -18.2128 372 M 186.0 82.0 . J 0 . 28.9343 -1.1403 373 M 182.0 90.0 100 J 40000 . 32.6397 -9.2809 374 M 178.0 95.0 . 1000 No . 34.0123 -15.5352 375 M 178.0 100.0 112 G 60000 . 37.9001 -18.6792
/* Lesson 13-2 */ /* File Name = les1302.sas 07/12/16 */ data gakusei; infile 'all07ae.prn' firstobs=2; input sex $ shintyou taijyuu kyoui jitaku $ kodukai carryer $ tsuuwa; proc print data=gakusei(obs=10); run; proc princomp cov data=gakusei out=outprin; : 主成分分析(分散共分散行列) var shintyou taijyuu kyoui; : 3変量 run; : proc print data=outprin(obs=15); : 結果の出力 run; : proc plot data=outprin; : 散布図 plot prin2*prin1/vref=0 href=0; : 主成分得点のプロット plot prin3*prin2/vref=0 href=0; : plot prin3*prin1/vref=0 href=0; : run; :
SAS システム 3
10:30 Monday, July 9, 2016
Principal Component Analysis
114 Observations
3 Variables
Simple Statistics
SHINTYOU TAIJYUU KYOUI
Mean 167.3517544 58.79298246 86.17543860
StD 8.7227627 10.86282708 8.36262822
SAS システム 4
10:30 Monday, July 9, 2016
Principal Component Analysis
Covariance Matrix
SHINTYOU TAIJYUU KYOUI
SHINTYOU 76.0865898 69.6653222 23.7439373
TAIJYUU 69.6653222 118.0010123 43.5906226
KYOUI 23.7439373 43.5906226 69.9335507
SAS システム 5
10:30 Monday, July 9, 2016
Principal Component Analysis
Total Variance = 264.02115277
Eigenvalues of the Covariance Matrix
Eigenvalue Difference Proportion Cumulative
PRIN1 189.966 138.636 0.719512 0.71951
PRIN2 51.330 28.606 0.194417 0.91393
PRIN3 22.724 . 0.086070 1.00000
SAS システム 6
10:30 Monday, July 9, 2016
Principal Component Analysis
Eigenvectors
PRIN1 PRIN2 PRIN3
SHINTYOU 0.539085 -.407903 0.736887
TAIJYUU 0.751825 -.161336 -.639320
KYOUI 0.379667 0.898658 0.219698
SAS システム 7
10:30 Monday, July 9, 2016
S
H T K C
I A J O A T
N I K I D R S P P P
T J Y T U R U R R R
O S Y Y O A K Y U I I I
B E O U U K A E W N N N
S X U U I U I R A 1 2 3
1 F 145.0 38.0 . J 10000 . . . .
2 F 146.7 41.0 85 J 10000 Vodafone 6000 -24.9565 10.2382 -4.10085
3 F 148.0 42.0 . J 50000 . . . .
4 F 148.0 43.0 80 J 50000 DoCoMo 4000 -24.6504 4.8920 -5.52002
5 F 148.9 . . J 60000 . . . .
6 F 149.0 45.0 . G 60000 . . . .
7 F 150.0 46.0 86 40000 . -19.0388 8.9841 -4.64602
8 F 151.0 45.0 . J 20000 docomo 5000 . . .
9 F 151.0 50.0 . G 60000 J-PHONE . . . .
10 F 151.7 41.5 80 J 35000 . -23.7835 3.6248 -1.83456
11 F 152.0 35.0 77 J 60000 DoCoMo 2000 -29.6477 1.8551 1.88299
12 F 152.0 43.0 . J 20000 au 3500 . . .
13 F 152.0 44.0 . 45000 DoCoMo 4000 . . .
14 F 153.0 41.0 . J 125000 No . . . .
15 F 153.0 42.0 . G 0 Vodafone 1000 . . .
SAS システム 9
10:30 Monday, July 9, 2016
プロット : PRIN2*PRIN1. 凡例: A = 1 OBS, B = 2 OBS, ...
(NOTE: 261 オブザベーションが欠損値です.)
PRIN2 | |
20 + |
| A | A A A A
| AA AAB BDA D | A AC A
0 +--------A----A-ABCDAED-DAAADAEDABDCBAC-AA-A-----A----------------
| A A A A A C BAAB A A
| A A | A AA
-20 + |
| A |
| |
-40 + | A
---+-----------+-----------+-----------+-----------+-----------+--
-40 -20 0 20 40 60
PRIN1
SAS システム 10
10:30 Monday, July 9, 2016
プロット : PRIN3*PRIN2. 凡例: A = 1 OBS, B = 2 OBS, ...
(NOTE: 261 オブザベーションが欠損値です.)
PRIN3 | |
10 + A A A |
| AA A AB B |AA
| AA C BCFECA AA
0 +-------------------------------A----B-A--AA-BEDEDCBDA-----B------
| A A ACBAAEBBA ABA A
| A A AA B
-10 + A| A
| | A
| |A
-20 + A |
-+--------+--------+--------+--------+--------+--------+--------+-
-50 -40 -30 -20 -10 0 10 20
PRIN2
SAS システム 11
10:30 Monday, July 9, 2016
プロット : PRIN3*PRIN1. 凡例: A = 1 OBS, B = 2 OBS, ...
(NOTE: 261 オブザベーションが欠損値です.)
PRIN3 | |
10 + | A A A
| |AB B C B
| A A AC BB B |ABBCBAA C
0 +---------------ACABEBB-BCAABAABBAAB-B-------A--------------------
| AAA ABBA BA A A CAAABA AA
| A A AA | A A
-10 + A A |
| | A
| | A
-20 + | A
---+-----------+-----------+-----------+-----------+-----------+--
-40 -20 0 20 40 60
PRIN1
/* Lesson 13-3 */
/* File Name = les1303.sas 07/12/16 */
data gakusei;
infile 'all07ae.prn'
firstobs=2;
input sex $ shintyou taijyuu kyoui
jitaku $ kodukai carryer $ tsuuwa;
proc print data=gakusei(obs=10);
run; :
proc princomp data=gakusei out=outprin; : 相関係数を使って
var shintyou taijyuu kyoui; :
run; :
proc print data=outprin(obs=15);
run;
proc plot data=outprin;
plot prin2*prin1/vref=0 href=0;
plot prin3*prin2/vref=0 href=0;
plot prin3*prin1/vref=0 href=0;
run;
SAS システム 3
10:30 Monday, July 9, 2016
Principal Component Analysis
114 Observations
3 Variables
Simple Statistics
SHINTYOU TAIJYUU KYOUI
Mean 167.3517544 58.79298246 86.17543860
StD 8.7227627 10.86282708 8.36262822
SAS システム 4
10:30 Monday, July 9, 2016
Principal Component Analysis
Correlation Matrix
SHINTYOU TAIJYUU KYOUI
SHINTYOU 1.0000 0.7352 0.3255
TAIJYUU 0.7352 1.0000 0.4799
KYOUI 0.3255 0.4799 1.0000
SAS システム 5
10:30 Monday, July 9, 2016
Principal Component Analysis
Eigenvalues of the Correlation Matrix
Eigenvalue Difference Proportion Cumulative
PRIN1 2.04697 1.33665 0.682322 0.68232
PRIN2 0.71032 0.46760 0.236772 0.91909
PRIN3 0.24272 . 0.080906 1.00000
SAS システム 6
10:30 Monday, July 9, 2016
Principal Component Analysis
Eigenvectors
PRIN1 PRIN2 PRIN3
SHINTYOU 0.599200 -.483881 0.637823
TAIJYUU 0.640769 -.187770 -.744418
KYOUI 0.479974 0.854752 0.197544
/* Lesson 14-1 */ /* File Name = les1401.sas 07/19/16 */ data food; : infile 'food.dat'; : ファイルの読み込み input X01-X10; : 変量リスト、連続的に label X01='M(-15)' : 各変量に解りやすい名前を付ける X02='M(16-20)' : M : 男性 X03='M(21-30)' : F : 女性 X04='M(31-40)' : ()内 : 年齢 X05='M(41-)' : X06='F(-15)' : X07='F(16-20)' : X08='F(21-30)' : X09='F(31-40)' : X10='F(41-)'; : : proc print data=food(obs=10); : データの表示 run; : proc factor data=food; : オプションを付けないと主成分分析 var X01-X10; : 解析に使う変量リスト run; :
SAS システム 1 19:05 Wednesday, July 18, 2016 OBS X01 X02 X03 X04 X05 X06 X07 X08 X09 X10 1 7.69 7.31 7.47 7.76 7.87 7.51 7.24 7.70 7.91 7.95 2 6.59 5.56 6.21 6.04 5.81 6.64 6.11 6.53 6.44 6.64 3 4.55 4.18 4.36 4.25 4.53 4.60 3.66 4.04 3.68 4.43 4 6.78 6.11 6.30 5.98 5.56 6.37 6.29 5.43 5.32 5.28 5 6.47 6.24 6.02 5.42 5.88 6.00 5.60 4.60 5.40 5.95 SAS システム 2 19:05 Wednesday, July 18, 2016 Initial Factor Method: Principal Components Prior Communality Estimates: ONE Eigenvalues of the Correlation Matrix: Total = 10 Average = 1 1 2 3 4 5 Eigenvalue 6.8280 1.7619 0.7545 0.2624 0.1216 Difference 5.0661 1.0074 0.4921 0.1408 0.0236 Proportion 0.6828 0.1762 0.0754 0.0262 0.0122 Cumulative 0.6828 0.8590 0.9344 0.9607 0.9728 6 7 8 9 10 Eigenvalue 0.0980 0.0721 0.0441 0.0358 0.0219 Difference 0.0259 0.0280 0.0083 0.0139 Proportion 0.0098 0.0072 0.0044 0.0036 0.0022 Cumulative 0.9826 0.9898 0.9942 0.9978 1.0000 SAS システム 3 19:05 Wednesday, July 18, 2016 Initial Factor Method: Principal Components 2 factors will be retained by the MINEIGEN criterion. SAS システム 4 19:05 Wednesday, July 18, 2016 Initial Factor Method: Principal Components Factor Pattern FACTOR1 FACTOR2 X01 0.74741 -0.59244 M(-15) X02 0.86579 -0.31836 M(16-20) X03 0.84491 0.22079 M(21-30) X04 0.78216 0.47602 M(31-40) X05 0.68129 0.67325 M(41-) X06 0.80647 -0.54140 F(-15) X07 0.89959 -0.33542 F(16-20) X08 0.90901 -0.04289 F(21-30) X09 0.90316 0.21817 F(31-40) X10 0.79262 0.35477 F(41-) SAS システム 5 19:05 Wednesday, July 18, 2016 Initial Factor Method: Principal Components Variance explained by each factor FACTOR1 FACTOR2 6.827955 1.761873 Final Communality Estimates: Total = 8.589828 X01 X02 X03 X04 X05 0.909618 0.850950 0.762624 0.838371 0.917413 X06 X07 X08 X09 X10 0.943520 0.921775 0.828147 0.863298 0.754112
/* Lesson 14-2 */ /* File Name = les1402.sas 07/19/16 */ data food; infile 'food.dat'; input X01-X10; label X01='M(-15)' X02='M(16-20)' X03='M(21-30)' X04='M(31-40)' X05='M(41-)' X06='F(-15)' X07='F(16-20)' X08='F(21-30)' X09='F(31-40)' X10='F(41-)'; proc print data=food(obs=10); run; : proc factor data=food nfactor=3 out=fscore; : 因子数3、出力の保存 var X01-X10; : run; : proc plot data=fscore; : plot factor1*factor2/vref=0.0 href=0.0; : 第1因子 x 第2因子、軸 plot factor2*factor3/vref=0.0 href=0.0; : 第2因子 x 第3因子、軸 run; :
SAS システム 2 19:05 Wednesday, July 18, 2016 Initial Factor Method: Principal Components Prior Communality Estimates: ONE Eigenvalues of the Correlation Matrix: Total = 10 Average = 1 1 2 3 4 5 Eigenvalue 6.8280 1.7619 0.7545 0.2624 0.1216 Difference 5.0661 1.0074 0.4921 0.1408 0.0236 Proportion 0.6828 0.1762 0.0754 0.0262 0.0122 Cumulative 0.6828 0.8590 0.9344 0.9607 0.9728 6 7 8 9 10 Eigenvalue 0.0980 0.0721 0.0441 0.0358 0.0219 Difference 0.0259 0.0280 0.0083 0.0139 Proportion 0.0098 0.0072 0.0044 0.0036 0.0022 Cumulative 0.9826 0.9898 0.9942 0.9978 1.0000 SAS システム 3 19:05 Wednesday, July 18, 2016 Initial Factor Method: Principal Components 3 factors will be retained by the NFACTOR criterion. SAS システム 4 19:05 Wednesday, July 18, 2016 Initial Factor Method: Principal Components Factor Pattern FACTOR1 FACTOR2 FACTOR3 X01 0.74741 -0.59244 0.16808 M(-15) X02 0.86579 -0.31836 0.29190 M(16-20) X03 0.84491 0.22079 0.38417 M(21-30) X04 0.78216 0.47602 0.32604 M(31-40) X05 0.68129 0.67325 0.11067 M(41-) X06 0.80647 -0.54140 -0.07270 F(-15) X07 0.89959 -0.33542 -0.14888 F(16-20) X08 0.90901 -0.04289 -0.25110 F(21-30) X09 0.90316 0.21817 -0.27989 F(31-40) X10 0.79262 0.35477 -0.45389 F(41-) SAS システム 5 19:05 Wednesday, July 18, 2016 Initial Factor Method: Principal Components Variance explained by each factor FACTOR1 FACTOR2 FACTOR3 6.827955 1.761873 0.754451 Final Communality Estimates: Total = 9.344279 X01 X02 X03 X04 X05 0.937870 0.936157 0.910210 0.944673 0.929662 X06 X07 X08 X09 X10 0.948805 0.943939 0.891197 0.941637 0.960129 SAS システム 6 19:05 Wednesday, July 18, 2016 Initial Factor Method: Principal Components Scoring Coefficients Estimated by Regression Squared Multiple Correlations of the Variables with each Factor FACTOR1 FACTOR2 FACTOR3 1.000000 1.000000 1.000000 SAS システム 7 19:05 Wednesday, July 18, 2016 Initial Factor Method: Principal Components Standardized Scoring Coefficients FACTOR1 FACTOR2 FACTOR3 X01 0.10946 -0.33626 0.22279 M(-15) X02 0.12680 -0.18069 0.38691 M(16-20) X03 0.12374 0.12531 0.50920 M(21-30) X04 0.11455 0.27018 0.43215 M(31-40) X05 0.09978 0.38212 0.14670 M(41-) X06 0.11811 -0.30729 -0.09636 F(-15) X07 0.13175 -0.19038 -0.19733 F(16-20) X08 0.13313 -0.02434 -0.33282 F(21-30) X09 0.13227 0.12383 -0.37099 F(31-40) X10 0.11609 0.20136 -0.60162 F(41-) SAS システム 8 19:05 Wednesday, July 18, 2016 プロット : FACTOR1*FACTOR2. 凡例: A = 1 OBS, B = 2 OBS, ... 5 + | | | FACTOR1 | | | A A |A B A | A A A AA BBA AAADA BB A AA A A A 0 +----A-------A----AAB--AAA----ACA---BABAAA-B--AAAAA--AA-A--A--A- | A AA A A A A A A A | ABAAABB BA A A A | A A A | A A | | A | | -5 + | --+-----------+-----------+-----------+-----------+-----------+- -3 -2 -1 0 1 2 FACTOR2 SAS システム 9 19:05 Wednesday, July 18, 2016 プロット : FACTOR2*FACTOR3. 凡例: A = 1 OBS, B = 2 OBS, ... FACTOR2 | | 2.5 + | | A A A A | AC A A A | AA ABA ADABA AB| B A AA AA A 0.0 +---BA----AAAA-CBA--A-+-ECB-A------A----A--------A-------------- | A A BAA ABB AB AABAB | B AA B AAAAA A A -2.5 + | A | | | | -5.0 + | --+---------+---------+---------+---------+---------+---------+- -2 -1 0 1 2 3 4 FACTOR3
/* Lesson 14-3 */ /* File Name = les1403.sas 07/19/16 */ data food; infile 'food.dat'; input X01-X10; label X01='M(-15)' X02='M(16-20)' X03='M(21-30)' X04='M(31-40)' X05='M(41-)' X06='F(-15)' X07='F(16-20)' X08='F(21-30)' X09='F(31-40)' X10='F(41-)'; proc print data=food(obs=10); run; proc factor data=food nfactor=3 rotate=varimax out=fscore2; var X01-X10; : 回転の指定 run; : proc print data=fscore2; run; proc plot data=fscore2; plot factor1*factor2/vref=0.0 href=0.0; plot factor2*factor3/vref=0.0 href=0.0; plot factor3*factor1/vref=0.0 href=0.0; run;
SAS システム 6 19:05 Wednesday, July 18, 2016 Rotation Method: Varimax Orthogonal Transformation Matrix 1 2 3 1 0.65751 0.53576 0.52976 2 -0.73452 0.61238 0.29234 3 0.16779 0.58134 -0.79617 SAS システム 7 19:05 Wednesday, July 18, 2016 Rotation Method: Varimax Rotated Factor Pattern FACTOR1 FACTOR2 FACTOR3 X01 0.95480 0.13534 0.08893 M(-15) X02 0.85209 0.43859 0.13319 M(16-20) X03 0.45782 0.81121 0.20628 M(21-30) X04 0.21933 0.90009 0.29393 M(31-40) X05 -0.02799 0.84163 0.46962 M(41-) X06 0.91574 0.05827 0.32684 F(-15) X07 0.81289 0.19001 0.49704 F(16-20) X08 0.58706 0.31477 0.66894 F(21-30) X09 0.38662 0.45477 0.76508 F(31-40) X10 0.18442 0.37804 0.88499 F(41-) SAS システム 8 19:05 Wednesday, July 18, 2016 Rotation Method: Varimax Variance explained by each factor FACTOR1 FACTOR2 FACTOR3 3.923686 2.875550 2.545044 Final Communality Estimates: Total = 9.344279 X01 X02 X03 X04 X05 0.937870 0.936157 0.910210 0.944673 0.929662 X06 X07 X08 X09 X10 0.948805 0.943939 0.891197 0.941637 0.960129 SAS システム 9 19:05 Wednesday, July 18, 2016 Rotation Method: Varimax Scoring Coefficients Estimated by Regression Squared Multiple Correlations of the Variables with each Factor FACTOR1 FACTOR2 FACTOR3 1.000000 1.000000 1.000000 SAS システム 10 19:05 Wednesday, July 18, 2016 Rotation Method: Varimax Standardized Scoring Coefficients FACTOR1 FACTOR2 FACTOR3 X01 0.35634 -0.01776 -0.21769 M(-15) X02 0.28101 0.18221 -0.29369 M(16-20) X03 0.07475 0.43906 -0.30323 M(21-30) X04 -0.05062 0.47805 -0.20440 M(31-40) X05 -0.19046 0.37274 0.04777 M(41-) X06 0.28720 -0.18091 0.04945 F(-15) X07 0.19335 -0.16071 0.17125 F(16-20) X08 0.04957 -0.13707 0.32839 F(21-30) X09 -0.06623 -0.06897 0.40164 F(31-40) X10 -0.17252 -0.16424 0.59935 F(41-) SAS システム 11 19:05 Wednesday, July 18, 2016 OBS X01 X02 X03 X04 X05 X06 X07 X08 1 7.69 7.31 7.47 7.76 7.87 7.51 7.24 7.70 2 6.59 5.56 6.21 6.04 5.81 6.64 6.11 6.53 3 4.55 4.18 4.36 4.25 4.53 4.60 3.66 4.04 4 6.78 6.11 6.30 5.98 5.56 6.37 6.29 5.43 5 6.47 6.24 6.02 5.42 5.88 6.00 5.60 4.60 6 6.96 6.81 6.91 6.48 6.23 7.09 7.27 7.13 OBS X09 X10 FACTOR1 FACTOR2 FACTOR3 1 7.91 7.95 0.66848 1.82089 1.58151 2 6.44 6.64 0.16753 -0.19985 1.19223 3 3.68 4.43 -1.03317 -1.44074 -0.47196 4 5.32 5.28 0.63828 0.22675 -0.50040 5 5.40 5.95 0.18212 0.09192 -0.20819 6 6.86 7.36 0.74098 0.36705 1.34820 SAS システム 12 19:05 Wednesday, July 18, 2016 OBS X01 X02 X03 X04 X05 X06 X07 X08 7 6.57 5.70 5.89 5.16 5.30 6.07 5.56 4.50 8 7.32 6.95 6.02 4.98 4.88 6.82 6.40 5.53 9 6.51 6.15 5.51 4.68 4.16 5.17 4.81 4.70 10 6.86 6.05 5.85 6.14 6.75 6.71 5.39 5.42 11 7.04 6.03 6.53 6.02 6.68 6.78 5.91 6.26 12 6.59 6.30 6.29 5.94 6.10 5.93 5.52 5.35 OBS X09 X10 FACTOR1 FACTOR2 FACTOR3 7 4.92 5.33 0.32212 -0.32353 -0.54867 8 5.61 5.33 1.29399 -0.70772 -0.34096 9 4.86 3.82 0.58563 -0.74996 -1.38927 10 6.03 6.59 0.02082 0.39858 0.55099 11 5.76 5.95 0.40333 0.58990 0.17654 12 5.45 5.85 0.19777 0.54869 -0.27747 SAS システム 13 19:05 Wednesday, July 18, 2016 OBS X01 X02 X03 X04 X05 X06 X07 X08 13 5.93 4.76 5.09 5.51 5.79 5.49 4.97 4.69 14 7.00 6.31 6.82 6.26 5.26 6.69 6.27 5.94 15 6.63 5.47 5.54 4.88 4.70 5.89 4.64 4.43 16 6.56 6.57 5.74 4.76 4.39 6.56 6.29 5.61 17 5.80 5.44 4.75 4.69 4.65 5.23 4.83 4.66 18 6.39 6.14 6.21 5.48 5.40 6.32 6.19 6.44 OBS X09 X10 FACTOR1 FACTOR2 FACTOR3 13 5.30 5.61 -0.59891 -0.44433 0.31937 14 5.78 5.26 0.91545 0.42234 -0.53556 15 4.00 3.98 0.46237 -0.53286 -1.57500 16 5.22 4.72 1.11088 -1.07750 -0.45395 17 4.72 4.98 -0.13938 -1.22229 -0.20671 18 5.49 5.49 0.56235 -0.28372 0.15357 SAS システム 14 19:05 Wednesday, July 18, 2016 OBS X01 X02 X03 X04 X05 X06 X07 X08 19 7.19 6.66 6.58 5.33 5.03 7.13 7.19 6.62 20 5.76 6.63 7.02 7.37 7.27 5.93 5.89 6.70 21 5.74 5.71 5.93 6.12 6.24 5.42 5.69 6.10 22 5.52 5.28 5.17 4.69 4.87 4.86 4.66 4.10 23 4.89 4.75 5.02 5.14 4.65 4.96 4.17 3.89 24 6.46 6.88 6.93 6.74 6.52 6.14 6.64 5.81 OBS X09 X10 FACTOR1 FACTOR2 FACTOR3 19 5.78 5.23 1.42714 -0.49423 -0.05168 20 6.82 6.97 -0.35623 1.77580 0.83460 21 6.25 6.45 -0.47556 0.23363 0.99794 22 4.62 4.10 -0.26665 -0.65259 -0.96309 23 4.61 4.01 -0.63574 -0.58237 -0.93949 24 6.14 6.59 0.33341 1.19569 0.15960 SAS システム 15 19:05 Wednesday, July 18, 2016 OBS X01 X02 X03 X04 X05 X06 X07 X08 25 6.42 6.79 7.26 6.68 6.48 6.32 5.85 5.14 26 5.89 6.51 6.46 6.31 5.76 5.54 4.38 4.51 27 4.16 4.73 5.75 5.79 5.29 3.35 4.16 4.33 28 5.99 6.10 5.84 5.49 4.82 5.04 4.44 4.09 29 6.97 5.84 5.47 4.58 4.75 6.71 5.90 5.08 30 7.15 6.76 6.56 5.73 5.13 6.99 6.27 5.75 OBS X09 X10 FACTOR1 FACTOR2 FACTOR3 25 6.21 5.55 0.37449 1.61803 -0.74503 26 5.75 5.11 -0.09504 1.13524 -1.07720 27 5.49 4.72 -1.46393 0.43161 -0.39411 28 5.01 4.31 0.06458 0.18701 -1.46831 29 4.87 5.01 0.86305 -1.21930 -0.35051 30 5.58 4.98 1.22856 0.06522 -0.75458 ≪略≫ SAS システム 25 19:05 Wednesday, July 18, 2016 OBS X01 X02 X03 X04 X05 X06 X07 X08 85 6.96 5.61 4.34 4.28 4.15 6.46 5.70 5.31 86 5.71 5.58 5.46 5.10 5.57 5.46 5.94 5.19 87 5.30 5.88 5.35 5.24 5.68 5.17 5.91 5.06 88 7.09 6.39 5.60 6.18 5.81 7.12 6.69 5.96 89 6.93 6.73 5.60 5.63 6.13 7.13 6.66 6.42 90 7.46 6.19 5.42 4.70 3.68 7.33 6.73 5.58 OBS X09 X10 FACTOR1 FACTOR2 FACTOR3 85 4.77 4.19 0.89484 -2.11006 -0.27929 86 5.78 6.23 -0.28762 -0.71826 0.87305 87 5.56 6.10 -0.40623 -0.50420 0.66559 88 6.28 6.60 0.66657 -0.37147 0.91228 89 6.44 6.50 0.69692 -0.51150 1.12494 90 4.18 3.39 1.90587 -1.55808 -1.44320 SAS システム 26 19:05 Wednesday, July 18, 2016 OBS X01 X02 X03 X04 X05 X06 X07 X08 91 6.38 5.28 5.07 3.96 4.25 6.28 5.21 4.65 92 7.41 6.97 5.91 4.96 4.86 7.19 6.72 5.98 93 7.77 6.47 5.71 5.26 4.91 7.72 7.03 6.42 94 7.96 7.13 6.36 6.18 5.71 7.92 7.59 6.87 95 7.62 6.48 5.75 4.69 4.65 7.82 7.17 6.31 96 8.44 7.52 6.82 6.88 6.05 8.48 8.33 7.25 OBS X09 X10 FACTOR1 FACTOR2 FACTOR3 91 4.49 4.64 0.50096 -1.77073 -0.41813 92 5.53 5.52 1.45131 -0.95522 -0.05731 93 5.52 5.46 1.57106 -1.13765 0.18885 94 6.77 6.43 1.56707 -0.24567 0.79587 95 5.53 5.58 1.64304 -1.55742 0.37033 96 6.83 6.55 1.98060 0.32279 0.62116 SAS システム 27 19:05 Wednesday, July 18, 2016 OBS X01 X02 X03 X04 X05 X06 X07 X08 97 7.81 7.31 6.93 7.42 6.60 8.10 7.56 7.79 98 8.29 7.45 7.00 6.76 6.69 8.14 7.09 6.83 99 7.20 6.42 6.23 5.92 5.91 6.98 6.44 6.04 100 7.62 7.33 6.91 6.90 6.47 7.33 6.69 7.23 OBS X09 X10 FACTOR1 FACTOR2 FACTOR3 97 7.82 7.67 1.18227 0.72902 1.67725 98 6.83 7.13 1.41828 0.79855 0.65451 99 6.14 6.02 0.78541 0.01100 0.33576 100 6.79 6.70 1.06526 0.90338 0.58077 SAS システム 28 19:05 Wednesday, July 18, 2016 プロット : FACTOR1*FACTOR2. 凡例: A = 1 OBS, B = 2 OBS, ... 2 + A | A | A AA A A | A A FACTOR1 | A AA |A A A A A | A B AA AB B C A A A A A | A A A B | A AA A A A 0 +-----------------A-A---------B-+AA-AA--A-AA-------------------- | A B AA AA| A A A A A | A AA A|A C AA | A A AA A AA B | A A A | A A | AA A -2 + A A A| A --+---------+---------+---------+---------+---------+---------+- -3 -2 -1 0 1 2 3 FACTOR2 SAS システム 29 19:05 Wednesday, July 18, 2016 プロット : FACTOR2*FACTOR3. 凡例: A = 1 OBS, B = 2 OBS, ... FACTOR2 | | 4 + | | | | A A | 2 + A | A A | A AA A | AAA A A A | A A A A A AAA |ABB BAB A B AA 0 +--------------------------A------B--D--AA+ACB-AAABAB-A--------- | A A AAA A C| BA BA C A A | A A CA A | A B AB A -2 + A A AA | --+---------+---------+---------+---------+---------+---------+- -4 -3 -2 -1 0 1 2 FACTOR3 SAS システム 30 19:05 Wednesday, July 18, 2016 プロット : FACTOR3*FACTOR1. 凡例: A = 1 OBS, B = 2 OBS, ... FACTOR3 | | 2.5 + | | A B |A BA A | A BABA A C ABBAA AAA AB A A A A 0.0 +-------------A-----BA-A-AAA---A--A-A-+-BAAC-AABAA-A--AC-AA----- | A AA A A A B B| B A ABBB A AA | A A |A AA A -2.5 + A A | A | A | | | -5.0 + | --+-----------+-----------+-----------+-----------+-----------+- -3 -2 -1 0 1 2 FACTOR1
/* Lesson 14-4 */ /* File Name = les1404.sas 07/19/16 */ data hobby; infile 'syumi.dat'; input code $ X1-X6; label X1='M(-29)' X2='M(30-49)' X3='M(50-)' X4='F(-29)' X5='F(30-49)' X6='F(50-)'; proc print data=hobby(obs=10); run; proc factor data=hobby nfactor=2 out=fscore; var X1-X6; run; proc plot data=fscore; : 回転前 plot factor1*factor2=code/vref=0.0 href=0.0; : コード化した記号 run; : proc factor data=hobby nfactor=2 rotate=varimax out=fscore2; var X1-X6; run; proc plot data=fscore2; : 回転後 plot factor1*factor2=code/vref=0.0 href=0.0; : コード化した記号 run; :
SAS システム 1 19:05 Wednesday, July 18, 2016 OBS CODE X1 X2 X3 X4 X5 X6 1 A 4.00 4.25 3.83 4.50 4.67 4.00 2 B 4.17 3.89 4.00 4.50 4.17 3.75 3 C 3.83 3.44 2.83 3.57 3.17 1.50 4 D 2.83 4.22 3.83 3.71 3.00 2.25 5 E 4.17 4.11 3.83 3.57 4.00 3.75 6 F 2.33 3.56 3.33 2.93 2.83 2.75 7 G 1.83 2.44 2.33 3.71 3.83 3.75 8 H 2.50 1.89 2.00 4.21 3.17 3.75 9 I 2.00 1.44 2.00 4.07 3.33 3.50 10 J 4.00 3.33 3.33 3.00 3.17 2.25 SAS システム 2 19:05 Wednesday, July 18, 2016 Initial Factor Method: Principal Components Prior Communality Estimates: ONE Eigenvalues of the Correlation Matrix: Total = 6 Average = 1 1 2 3 Eigenvalue 2.7435 1.7477 0.7451 Difference 0.9958 1.0027 0.3571 Proportion 0.4573 0.2913 0.1242 Cumulative 0.4573 0.7485 0.8727 4 5 6 Eigenvalue 0.3879 0.2263 0.1495 Difference 0.1616 0.0768 Proportion 0.0647 0.0377 0.0249 Cumulative 0.9374 0.9751 1.0000 SAS システム 3 19:05 Wednesday, July 18, 2016 Initial Factor Method: Principal Components 2 factors will be retained by the NFACTOR criterion. Factor Pattern FACTOR1 FACTOR2 X1 0.52708 0.63297 M(-29) X2 0.59628 0.64623 M(30-49) X3 0.64192 0.47370 M(50-) X4 0.82757 -0.35514 F(-29) X5 0.79607 -0.43033 F(30-49) X6 0.61604 -0.62750 F(50-) SAS システム 4 19:05 Wednesday, July 18, 2016 Initial Factor Method: Principal Components Variance explained by each factor FACTOR1 FACTOR2 2.743514 1.747721 Final Communality Estimates: Total = 4.491236 X1 X2 X3 X4 X5 X6 0.678467 0.773166 0.636447 0.810993 0.818906 0.773257 SAS システム 5 19:05 Wednesday, July 18, 2016 Initial Factor Method: Principal Components Scoring Coefficients Estimated by Regression Squared Multiple Correlations of the Variables with each Factor FACTOR1 FACTOR2 1.000000 1.000000 SAS システム 6 19:05 Wednesday, July 18, 2016 Initial Factor Method: Principal Components Standardized Scoring Coefficients FACTOR1 FACTOR2 X1 0.19212 0.36217 M(-29) X2 0.21734 0.36976 M(30-49) X3 0.23398 0.27104 M(50-) X4 0.30164 -0.20320 F(-29) X5 0.29016 -0.24622 F(30-49) X6 0.22454 -0.35904 F(50-) SAS システム 7 19:05 Wednesday, July 18, 2016 プロット : FACTOR1*FACTOR2. 使用するプロット文字: CODE の値. (NOTE: 1 オブザベーションを表示していません.) 2 + A B | | Z E FACTOR1 | R | | | | 3 Q M | DL O 0 +--------------HG------------S-----2--+--F-------C-------------- | I K P | V N | | U W | 1|Y | T X -2 + 4 | --+-----------+-----------+-----------+-----------+-----------+- -3 -2 -1 0 1 2 FACTOR2 SAS システム 8 19:05 Wednesday, July 18, 2016 Initial Factor Method: Principal Components Prior Communality Estimates: ONE Eigenvalues of the Correlation Matrix: Total = 6 Average = 1 1 2 3 Eigenvalue 2.7435 1.7477 0.7451 Difference 0.9958 1.0027 0.3571 Proportion 0.4573 0.2913 0.1242 Cumulative 0.4573 0.7485 0.8727 4 5 6 Eigenvalue 0.3879 0.2263 0.1495 Difference 0.1616 0.0768 Proportion 0.0647 0.0377 0.0249 Cumulative 0.9374 0.9751 1.0000 SAS システム 9 19:05 Wednesday, July 18, 2016 Initial Factor Method: Principal Components 2 factors will be retained by the NFACTOR criterion. Factor Pattern FACTOR1 FACTOR2 X1 0.52708 0.63297 M(-29) X2 0.59628 0.64623 M(30-49) X3 0.64192 0.47370 M(50-) X4 0.82757 -0.35514 F(-29) X5 0.79607 -0.43033 F(30-49) X6 0.61604 -0.62750 F(50-) SAS システム 10 19:05 Wednesday, July 18, 2016 Initial Factor Method: Principal Components Variance explained by each factor FACTOR1 FACTOR2 2.743514 1.747721 Final Communality Estimates: Total = 4.491236 X1 X2 X3 X4 X5 X6 0.678467 0.773166 0.636447 0.810993 0.818906 0.773257 SAS システム 11 19:05 Wednesday, July 18, 2016 Rotation Method: Varimax Orthogonal Transformation Matrix 1 2 1 0.77751 0.62886 2 -0.62886 0.77751 SAS システム 12 19:05 Wednesday, July 18, 2016 Rotation Method: Varimax Rotated Factor Pattern FACTOR1 FACTOR2 X1 0.01176 0.82361 M(-29) X2 0.05723 0.87743 M(30-49) X3 0.20121 0.77199 M(50-) X4 0.86678 0.24430 F(-29) X5 0.88957 0.16603 F(30-49) X6 0.87359 -0.10049 F(50-) Variance explained by each factor FACTOR1 FACTOR2 2.349707 2.141529 SAS システム 13 19:05 Wednesday, July 18, 2016 Rotation Method: Varimax Final Communality Estimates: Total = 4.491236 X1 X2 X3 X4 X5 X6 0.678467 0.773166 0.636447 0.810993 0.818906 0.773257 Scoring Coefficients Estimated by Regression Squared Multiple Correlations of the Variables with each Factor FACTOR1 FACTOR2 1.000000 1.000000 SAS システム 14 19:05 Wednesday, July 18, 2016 Rotation Method: Varimax Standardized Scoring Coefficients FACTOR1 FACTOR2 X1 -0.07838 0.40241 M(-29) X2 -0.06354 0.42417 M(30-49) X3 0.01147 0.35788 M(50-) X4 0.36232 0.03170 F(-29) X5 0.38045 -0.00897 F(30-49) X6 0.40037 -0.13795 F(50-) SAS システム 15 19:05 Wednesday, July 18, 2016 プロット : FACTOR1*FACTOR2. 使用するプロット文字: CODE の値. 2 + | | | A FACTOR1 | I H G 3 | R ZB | Q | E | K S |M 0 +---------------------P-2--+------------D------------- | |F CJ L O | Y | V N | 4 1 T | U | X | W -2 + | ---+-----------+-----------+-----------+-----------+-- -2 -1 0 1 2 FACTOR2