| 略号 | 政党名 |
|---|---|
| A | 日本共産党 |
| B | 日本維新の会 |
| C | 無所属連合 |
| D | 日本保守党 |
| E | 立憲民主党 |
| F | 参政党 |
| G | 国民民主党 |
| H | チームみらい |
| I | 日本誠真会 |
| J | 社会民主党 |
| K | れいわ新選組 |
| L | 日本改革党 |
| M | 自由民主党 |
| N | 再生の道 |
| O | 公明党 |
| P | NHK党 |
## [1] "KWM" "SHM" "TMN" "NAS" "NKD" "ITO" "FRK" "YMG" "MRK" "MTS" "MOR" "OKZ"
## [13] "NOD"
## 略号 候補者名
## 1 KWM かわもと健一
## 2 SHM しもの六太
## 3 TMN とみなが正博
## 4 NAS なす敬子
## 5 NKD 中田ゆうこ
## 6 ITO 伊藤博文
## 要求されたパッケージ ggrepel をロード中です
par(pty="s",family="HiraKakuProN-W3")
plot(ca_analysis,map="symmetric",main="symmetric map(Greenacre)")
ca(df[,-1],graph=TRUE)
##
## Principal inertias (eigenvalues):
## 1 2 3 4 5 6 7
## Value 0.017051 0.006792 0.002686 0.001983 0.001056 0.000781 0.000575
## Percentage 53.28% 21.22% 8.39% 6.2% 3.3% 2.44% 1.8%
## 8 9 10 11 12 13 14 15
## Value 0.000245 0.000157 0.00013 0.000126 8e-05 6.8e-05 5.7e-05 4.7e-05
## Percentage 0.77% 0.49% 0.41% 0.39% 0.25% 0.21% 0.18% 0.15%
## 16 17 18 19 20 21 22 23 24
## Value 3.4e-05 2.6e-05 2.1e-05 1.7e-05 1.5e-05 1.4e-05 1.1e-05 8e-06 6e-06
## Percentage 0.11% 0.08% 0.07% 0.05% 0.05% 0.04% 0.03% 0.02% 0.02%
## 25 26 27 28
## Value 6e-06 5e-06 4e-06 1e-06
## Percentage 0.02% 0.02% 0.01% 0%
##
##
## Rows:
## [,1] [,2] [,3] [,4] [,5] [,6] [,7]
## Mass 0.017599 0.031582 0.037650 0.014827 0.012235 0.045409 0.010895
## ChiDist 0.213219 0.112814 0.103913 0.211534 0.138927 0.092529 0.217057
## Inertia 0.000800 0.000402 0.000407 0.000663 0.000236 0.000389 0.000513
## Dim. 1 -1.193138 0.192309 -0.241374 -0.513687 -0.594357 -0.203556 -0.368859
## Dim. 2 -1.406567 -1.097838 -1.001674 -1.534677 -0.983286 -0.932094 -1.541806
## [,8] [,9] [,10] [,11] [,12] [,13] [,14]
## Mass 0.064176 0.045837 0.042166 0.053781 0.026464 0.046107 0.042947
## ChiDist 0.115051 0.240254 0.274036 0.119744 0.092905 0.099131 0.113609
## Inertia 0.000849 0.002646 0.003166 0.000771 0.000228 0.000453 0.000554
## Dim. 1 0.847224 1.687098 1.920086 0.885119 0.614819 0.643456 0.735845
## Dim. 2 -0.212513 -0.518892 0.796754 0.122456 0.292038 0.032540 0.338060
## [,15] [,16] [,17] [,18] [,19] [,20] [,21]
## Mass 0.020258 0.056125 0.010574 0.024170 0.008091 0.011816 0.011896
## ChiDist 0.255690 0.088787 0.158354 0.165977 0.317760 0.275139 0.395289
## Inertia 0.001324 0.000442 0.000265 0.000666 0.000817 0.000894 0.001859
## Dim. 1 -1.654923 -0.415184 -0.866007 -1.084503 -1.344762 -1.593660 -2.078904
## Dim. 2 -0.851377 0.551884 -0.530504 -0.442683 -1.982095 2.032174 2.567649
## [,22] [,23] [,24] [,25] [,26] [,27] [,28]
## Mass 0.009604 0.006025 0.014320 0.004973 0.007003 0.012499 0.022959
## ChiDist 0.233087 0.247980 0.118299 0.263350 0.214249 0.162422 0.095749
## Inertia 0.000522 0.000371 0.000200 0.000345 0.000321 0.000330 0.000210
## Dim. 1 -1.066321 -1.408922 -0.078845 -1.402390 -1.343836 -0.124101 0.154241
## Dim. 2 1.343152 1.635612 0.573361 1.443546 -1.440670 1.778448 0.938184
## [,29] [,30] [,31] [,32] [,33] [,34] [,35]
## Mass 0.023586 0.021809 0.020856 0.015173 0.012204 0.013921 0.005369
## ChiDist 0.083328 0.098869 0.113322 0.074494 0.083148 0.102025 0.226373
## Inertia 0.000164 0.000213 0.000268 0.000084 0.000084 0.000145 0.000275
## Dim. 1 0.301828 0.483718 0.191956 0.016679 -0.010963 0.462766 -1.535378
## Dim. 2 0.220453 0.561453 0.267180 0.566369 -0.047405 0.252157 0.660633
## [,36] [,37] [,38] [,39] [,40] [,41] [,42]
## Mass 0.004958 0.006526 0.009846 0.006780 0.021215 0.009705 0.006924
## ChiDist 0.204207 0.366322 0.331833 0.369323 0.106863 0.102088 0.211516
## Inertia 0.000207 0.000876 0.001084 0.000925 0.000242 0.000101 0.000310
## Dim. 1 -1.304404 -2.461985 -1.589136 -1.763520 -0.291783 0.003438 -0.705554
## Dim. 2 -0.899022 -1.269805 2.534218 3.361948 0.668204 -0.729569 -1.476630
## [,43] [,44] [,45] [,46] [,47] [,48] [,49]
## Mass 0.006210 0.008516 0.005208 0.006603 0.001793 0.009064 0.002593
## ChiDist 0.095997 0.148615 0.183042 0.158630 0.111023 0.152489 0.226366
## Inertia 0.000057 0.000188 0.000174 0.000166 0.000022 0.000211 0.000133
## Dim. 1 0.355407 0.486850 -0.077784 1.061128 -0.205976 0.865680 -1.322432
## Dim. 2 -0.198868 -0.716356 -1.170578 0.486087 -0.040811 -0.608240 -0.335027
## [,50] [,51] [,52] [,53] [,54] [,55] [,56]
## Mass 0.005264 0.006630 0.003853 0.001467 0.003126 0.002551 0.005978
## ChiDist 0.227656 0.106016 0.163136 0.307894 0.234560 0.234255 0.151355
## Inertia 0.000273 0.000075 0.000103 0.000139 0.000172 0.000140 0.000137
## Dim. 1 -1.034650 -0.496533 -1.015990 -2.147792 -1.540016 -1.666982 -0.798743
## Dim. 2 -2.015609 -0.308230 0.298522 -0.920886 -1.014802 -0.615410 1.007996
## [,57] [,58] [,59] [,60] [,61] [,62] [,63]
## Mass 0.000416 0.002974 0.002651 0.003785 0.002003 0.001738 0.001523
## ChiDist 0.636787 0.197377 0.196257 0.376931 0.341526 0.381996 0.420697
## Inertia 0.000169 0.000116 0.000102 0.000538 0.000234 0.000254 0.000269
## Dim. 1 -2.273698 -0.329311 -0.925396 -1.523117 -2.172780 -2.739237 -2.269072
## Dim. 2 5.030475 1.673246 1.421821 2.645676 -1.041608 -0.649580 -2.605103
## [,64] [,65] [,66] [,67] [,68] [,69] [,70]
## Mass 0.002615 0.000949 0.000569 0.003755 0.007247 0.003612 0.001329
## ChiDist 0.523500 0.464667 0.360597 0.311655 0.165412 0.253739 0.209194
## Inertia 0.000717 0.000205 0.000074 0.000365 0.000198 0.000233 0.000058
## Dim. 1 -2.996770 -2.489082 -2.114509 -1.579739 0.529160 -1.635915 -1.191097
## Dim. 2 -3.337086 -2.206279 -0.234927 -1.541843 -0.113610 1.173149 0.177453
## [,71] [,72]
## Mass 0.001596 0.003524
## ChiDist 0.312691 0.446075
## Inertia 0.000156 0.000701
## Dim. 1 -1.245981 -1.483197
## Dim. 2 2.333286 3.054922
##
##
## Columns:
## 日本共産党 日本維新の会 無所属連合 日本保守党 立憲民主党 参政党
## Mass 0.019535 0.024581 0.001896 0.030336 0.058192 0.074688
## ChiDist 0.283024 0.146516 0.192326 0.176057 0.127803 0.092426
## Inertia 0.001565 0.000528 0.000070 0.000940 0.000950 0.000638
## Dim. 1 -0.578608 0.960264 0.813012 1.269332 -0.601362 0.562249
## Dim. 2 -2.289349 0.013393 0.327606 -0.207556 0.740185 0.068137
## 国民民主党 チームみらい 日本誠真会 社会民主党 れいわ新選組 日本改革党
## Mass 0.062927 0.011841 0.003897 0.011133 0.036378 0.000454
## ChiDist 0.175587 0.374608 0.141780 0.188712 0.108898 0.196873
## Inertia 0.001940 0.001662 0.000078 0.000396 0.000431 0.000018
## Dim. 1 1.288343 2.588662 0.672913 -0.721944 -0.417048 0.122426
## Dim. 2 -0.003861 0.374440 0.215542 -0.399849 -0.416905 -0.052259
## 自由民主党 再生の道 公明党 NHK党 KWM SHM TMN
## Mass 0.099119 0.004830 0.054634 0.005155 0.066916 0.069970 0.004737
## ChiDist 0.148795 0.216984 0.218222 0.160400 0.202508 0.216977 0.123008
## Inertia 0.002194 0.000227 0.002602 0.000133 0.002744 0.003294 0.000072
## Dim. 1 -0.846874 0.290272 -1.236490 0.838006 1.509048 -1.227861 0.547997
## Dim. 2 1.060328 -0.650415 -1.543638 -0.595666 -0.179799 -1.601395 0.074928
## NAS NKD ITO FRK YMG MRK MTS
## Mass 0.009873 0.083117 0.022397 0.011544 0.016509 0.003007 0.091523
## ChiDist 0.222125 0.094679 0.151023 0.322981 0.324144 0.151283 0.169505
## Inertia 0.000487 0.000745 0.000511 0.001204 0.001735 0.000069 0.002630
## Dim. 1 -0.472718 0.598489 0.931704 2.247208 -0.543243 -0.061100 -0.761472
## Dim. 2 -0.583466 -0.070729 -0.308352 0.275899 -2.777235 -0.778539 1.327488
## MOR OKZ NOD
## Mass 0.024284 0.030219 0.066308
## ChiDist 0.175652 0.114377 0.212479
## Inertia 0.000749 0.000395 0.002994
## Dim. 1 1.268994 -0.258395 -0.881950
## Dim. 2 -0.208526 -0.539150 1.343792
(ファイルは文字化けしていない。)
## **Results of the Correspondence Analysis (CA)**
## The row variable has 72 categories; the column variable has 29 categories
## The chi square of independence between the two variables is equal to 146535.4 (p-value = 0 ).
## *The results are available in the following objects:
##
## name description
## 1 "$eig" "eigenvalues"
## 2 "$col" "results for the columns"
## 3 "$col$coord" "coord. for the columns"
## 4 "$col$cos2" "cos2 for the columns"
## 5 "$col$contrib" "contributions of the columns"
## 6 "$row" "results for the rows"
## 7 "$row$coord" "coord. for the rows"
## 8 "$row$cos2" "cos2 for the rows"
## 9 "$row$contrib" "contributions of the rows"
## 10 "$call" "summary called parameters"
## 11 "$call$marge.col" "weights of the columns"
## 12 "$call$marge.row" "weights of the rows"
## eigenvalue variance.percent cumulative.variance.percent
## Dim.1 1.705052e-02 53.280020399 53.28002
## Dim.2 6.792183e-03 21.224429469 74.50445
## Dim.3 2.685828e-03 8.392762588 82.89721
## Dim.4 1.983187e-03 6.197127134 89.09434
## Dim.5 1.056269e-03 3.300661695 92.39500
## Dim.6 7.812349e-04 2.441227799 94.83623
## Dim.7 5.754342e-04 1.798135300 96.63436
## Dim.8 2.449509e-04 0.765430372 97.39979
## Dim.9 1.568821e-04 0.490230362 97.89003
## Dim.10 1.297057e-04 0.405308456 98.29533
## Dim.11 1.255359e-04 0.392278465 98.68761
## Dim.12 7.982209e-05 0.249430632 98.93704
## Dim.13 6.777252e-05 0.211777755 99.14882
## Dim.14 5.674796e-05 0.177327855 99.32615
## Dim.15 4.700258e-05 0.146875175 99.47302
## Dim.16 3.446457e-05 0.107695990 99.58072
## Dim.17 2.618888e-05 0.081835837 99.66256
## Dim.18 2.138088e-05 0.066811651 99.72937
## Dim.19 1.728785e-05 0.054021640 99.78339
## Dim.20 1.452471e-05 0.045387292 99.82878
## Dim.21 1.367072e-05 0.042718696 99.87149
## Dim.22 1.106387e-05 0.034572721 99.90607
## Dim.23 8.463666e-06 0.026447535 99.93251
## Dim.24 6.235992e-06 0.019486426 99.95200
## Dim.25 5.904991e-06 0.018452104 99.97045
## Dim.26 4.875211e-06 0.015234216 99.98569
## Dim.27 3.802058e-06 0.011880793 99.99757
## Dim.28 7.781670e-07 0.002431641 100.00000
##
## Call:
## CA(X = df[, -1], graph = FALSE)
##
## The chi square of independence between the two variables is equal to 146535.4 (p-value = 0 ).
##
## Eigenvalues
## Dim.1 Dim.2 Dim.3 Dim.4 Dim.5 Dim.6 Dim.7
## Variance 0.017 0.007 0.003 0.002 0.001 0.001 0.001
## % of var. 53.280 21.224 8.393 6.197 3.301 2.441 1.798
## Cumulative % of var. 53.280 74.504 82.897 89.094 92.395 94.836 96.634
## Dim.8 Dim.9 Dim.10 Dim.11 Dim.12 Dim.13 Dim.14
## Variance 0.000 0.000 0.000 0.000 0.000 0.000 0.000
## % of var. 0.765 0.490 0.405 0.392 0.249 0.212 0.177
## Cumulative % of var. 97.400 97.890 98.295 98.688 98.937 99.149 99.326
## Dim.15 Dim.16 Dim.17 Dim.18 Dim.19 Dim.20 Dim.21
## Variance 0.000 0.000 0.000 0.000 0.000 0.000 0.000
## % of var. 0.147 0.108 0.082 0.067 0.054 0.045 0.043
## Cumulative % of var. 99.473 99.581 99.663 99.729 99.783 99.829 99.871
## Dim.22 Dim.23 Dim.24 Dim.25 Dim.26 Dim.27 Dim.28
## Variance 0.000 0.000 0.000 0.000 0.000 0.000 0.000
## % of var. 0.035 0.026 0.019 0.018 0.015 0.012 0.002
## Cumulative % of var. 99.906 99.933 99.952 99.970 99.986 99.998 100.000
##
## Rows (the 10 first)
## Iner*1000 Dim.1 ctr cos2 Dim.2 ctr cos2 Dim.3
## 1 | 0.800 | -0.156 2.505 0.534 | 0.116 3.482 0.296 | 0.049
## 2 | 0.402 | 0.025 0.117 0.050 | 0.090 3.806 0.643 | 0.032
## 3 | 0.407 | -0.032 0.219 0.092 | 0.083 3.778 0.631 | 0.039
## 4 | 0.663 | -0.067 0.391 0.101 | 0.126 3.492 0.358 | 0.107
## 5 | 0.236 | -0.078 0.432 0.312 | 0.081 1.183 0.340 | 0.052
## 6 | 0.389 | -0.027 0.188 0.083 | 0.077 3.945 0.689 | 0.035
## 7 | 0.513 | -0.048 0.148 0.049 | 0.127 2.590 0.343 | 0.116
## 8 | 0.849 | 0.111 4.606 0.925 | 0.018 0.290 0.023 | 0.010
## 9 | 2.646 | 0.220 13.046 0.841 | 0.043 1.234 0.032 | -0.052
## 10 | 3.166 | 0.251 15.545 0.837 | -0.066 2.677 0.057 | 0.026
## ctr cos2
## 1 1.576 0.053 |
## 2 1.227 0.082 |
## 3 2.172 0.144 |
## 4 6.274 0.254 |
## 5 1.224 0.139 |
## 6 2.030 0.140 |
## 7 5.490 0.287 |
## 8 0.249 0.008 |
## 9 4.697 0.048 |
## 10 1.067 0.009 |
##
## Columns (the 10 first)
## Iner*1000 Dim.1 ctr cos2 Dim.2 ctr cos2 Dim.3
## 日本共産党 | 1.565 | -0.076 0.654 0.071 | 0.189 10.239 0.444 | 0.148
## 日本維新の会 | 0.528 | 0.125 2.267 0.732 | -0.001 0.000 0.000 | -0.009
## 無所属連合 | 0.070 | 0.106 0.125 0.305 | -0.027 0.020 0.020 | 0.000
## 日本保守党 | 0.940 | 0.166 4.888 0.886 | 0.017 0.131 0.009 | 0.014
## 立憲民主党 | 0.950 | -0.079 2.104 0.378 | -0.061 3.188 0.228 | 0.057
## 参政党 | 0.638 | 0.073 2.361 0.631 | -0.006 0.035 0.004 | -0.020
## 国民民主党 | 1.940 | 0.168 10.445 0.918 | 0.000 0.000 0.000 | -0.002
## チームみらい | 1.662 | 0.338 7.935 0.814 | -0.031 0.166 0.007 | 0.044
## 日本誠真会 | 0.078 | 0.088 0.176 0.384 | -0.018 0.018 0.016 | 0.032
## 社会民主党 | 0.396 | -0.094 0.580 0.250 | 0.033 0.178 0.030 | -0.036
## ctr cos2
## 日本共産党 16.021 0.275 |
## 日本維新の会 0.074 0.004 |
## 無所属連合 0.000 0.000 |
## 日本保守党 0.226 0.006 |
## 立憲民主党 7.098 0.201 |
## 参政党 1.121 0.047 |
## 国民民主党 0.006 0.000 |
## チームみらい 0.866 0.014 |
## 日本誠真会 0.145 0.050 |
## 社会民主党 0.527 0.036 |
## Warning in geom_bar(stat = "identity", fill = barfill, color = barcolor, :
## Ignoring empty aesthetic: `width`.
## Rows: 72 Columns: 30
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): municipality
## dbl (29): 日本共産党, 日本維新の会, 無所属連合, 日本保守党, 立憲民主党, 参政党, 国民民主党, チームみらい, 日本誠真会, 社会民...
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
## Rows: 72 Columns: 30
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): municipality
## dbl (29): 日本共産党, 日本維新の会, 無所属連合, 日本保守党, 立憲民主党, 参政党, 国民民主党, チームみらい, 日本誠真会, 社会民...
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
## Rows: 72 Columns: 30
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): municipality
## dbl (29): 日本共産党, 日本維新の会, 無所属連合, 日本保守党, 立憲民主党, 参政党, 国民民主党, チームみらい, 日本誠真会, 社会民...
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
## [1] "KWM" "SHM" "TMN" "NAS" "NKD" "ITO" "FRK" "YMG" "MRK" "MTS" "MOR" "OKZ"
## [13] "NOD"
# 6. グラフの表示
print(g)
# 保存用
ggsave("COR_Total_Correlation.png", g, width = 10, height = 7, dpi = 300)
library(readr)
mncplty <- read_csv("4letters.csv")
## New names:
## Rows: 72 Columns: 3
## ── Column specification
## ────────────────────────────────────────────────────────
## Delimiter: "," chr (2): Fkk72names, 市区町村名 dbl (1): ...1
## ℹ Use `spec()` to retrieve the full column specification for this data. ℹ
## Specify the column types or set `show_col_types = FALSE` to quiet this message.
## • `` -> `...1`
head(mncplty)
## # A tibble: 6 × 3
## ...1 Fkk72names 市区町村名
## <dbl> <chr> <chr>
## 1 1 Mojk 門司区
## 2 2 Kkrk 小倉北区
## 3 3 Kkrm 小倉南区
## 4 4 Wkmt 若松区
## 5 5 Yhth 八幡東区
## 6 6 Yhtn 八幡西区
tail(mncplty)
## # A tibble: 6 × 3
## ...1 Fkk72names 市区町村名
## <dbl> <chr> <chr>
## 1 67 Fkch 福智町
## 2 68 Kndm 苅田町
## 3 69 Mykm みやこ町
## 4 70 Ysht 吉富町
## 5 71 Kgmc 上毛町
## 6 72 Chkj 築上町
sorted_4letters <- read_csv("sorted_4letters.csv")
## Rows: 72 Columns: 2
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): Fkk72names, 市区町村名
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
sorted_4letters
## # A tibble: 72 × 2
## Fkk72names 市区町村名
## <chr> <chr>
## 1 Akmr 赤村
## 2 Ashy 芦屋町
## 3 Askr 朝倉市
## 4 Bzns 豊前市
## 5 Chkg 筑後市
## 6 Chkj 築上町
## 7 Chks 筑紫野市
## 8 Chkz 筑前町
## 9 Chuk 中央区
## 10 Dzfs 太宰府市
## # ℹ 62 more rows