O banco de dados e suas variáveis:

head(dados)
## # A tibble: 6 × 9
##      id `100m` `200m` `400m` `800m` `1500m` `3000m` Marathon Country  
##   <dbl> <chr>  <chr>  <chr>  <chr>  <chr>   <chr>   <chr>    <chr>    
## 1     1 11.61  22.94  54.50  2.15   4.43    9.79    178.52   Argentina
## 2     2 11.20  22.35  51.08  1.98   4.13    9.08    152.37   Australia
## 3     3 11.43  23.09  50.62  1.99   4.22    9.34    159.37   Austria  
## 4     4 11.41  23.04  52.00  2.00   4.14    8.88    157.85   Belgium  
## 5     5 11.46  23.05  53.30  2.16   4.58    9.81    169.98   Bermuda  
## 6     6 11.31  23.17  52.80  2.10   4.49    9.77    168.75   Brazil

a)Calcular distâncias euclidianas entre pares de países

d <- dist(dados[, 1:7])
d
##            1         2         3         4         5         6         7
## 2   3.719624                                                            
## 3   4.402443  1.374009                                                  
## 4   4.029231  2.325317  1.767880                                        
## 5   4.183013  3.905611  3.400632  1.943373                              
## 6   5.295224  4.501444  3.747412  2.364635  1.140263                    
## 7   6.241114  6.787614  6.140912  4.593822  3.078327  2.880017          
## 8   8.407235  6.096606  5.148854  4.535096  4.652440  3.683287  5.683846
## 9   8.187484  8.309049  7.529462  6.016577  4.619600  3.992330  2.029039
## 10  9.151104  9.167393  8.363994  6.871448  5.495225  4.784736  3.017449
## 11 10.137958  9.425741  8.477753  7.206795  6.091108  5.108855  4.422386
## 12 13.292344 14.730981 14.087849 12.600480 10.937888 10.661351  8.021789
## 13 12.704971 13.424861 12.736797 11.204321  9.568276  9.036244  6.892895
## 14 14.611639 12.399129 11.378915 10.832410 10.562102  9.461163 10.296645
## 15 14.086369 13.300737 12.388119 11.127529 10.084612  9.110390  8.253260
## 16 15.125515 15.001160 14.148198 12.767329 11.389021 10.567109  9.090297
## 17 16.625965 15.030605 14.035769 13.151601 12.472750 11.384020 11.378014
## 18 17.256005 16.015402 15.056447 14.012601 13.140803 12.093945 11.688319
## 19 19.175490 17.269291 16.271438 15.554057 15.039900 13.937769 14.179291
## 20 19.643447 18.057065 17.059411 16.178495 15.494373 14.409282 14.256279
## 21 20.467232 19.018265 18.046792 17.101108 16.336297 15.270946 14.979830
## 22 21.036542 20.465681 19.518965 18.298634 17.114067 16.174854 15.014366
## 23 22.133804 21.772926 20.835671 19.583549 18.296839 17.399543 16.078619
## 24 23.212062 22.017130 21.021705 20.006551 19.108773 18.068658 17.439040
## 25 24.057679 23.248619 22.248564 21.133897 20.048519 19.061865 18.063123
## 26 25.050816 24.480886 23.525405 22.323936 21.137133 20.198500 19.014203
## 27 26.055082 25.121813 24.150756 23.038281 22.029424 21.029620 20.125611
## 28 27.014696 26.310762 25.368545 24.185837 23.068086 22.108985 21.032406
## 29 28.140545 27.028150 26.048463 25.002116 24.072555 23.048486 22.290518
## 30 29.035995 28.179794 27.196263 26.080098 25.031784 24.043186 23.045956
## 31 30.076353 29.090572 28.090303 27.025923 26.032756 25.022810 24.125188
## 32 31.064353 30.445134 29.482050 28.297412 27.150422 26.203145 25.010732
## 33 32.305164 31.208480 30.137125 29.156253 28.228418 27.193871 26.311174
## 34 33.103598 32.512853 31.543768 30.356563 29.204281 28.260262 27.027691
## 35 34.042084 33.344605 32.363415 31.231785 30.092825 29.132393 28.018637
## 36 35.269508 34.883793 33.939009 32.711923 31.456243 30.550555 29.209284
## 37 36.016287 35.136157 34.152862 33.063306 32.013952 31.025056 30.039784
## 38 37.073060 36.026574 35.047723 34.003622 33.028585 32.016936 31.174514
## 39 38.125975 37.014967 36.018263 35.002916 34.061512 33.039700 32.223667
## 40 39.048951 38.072917 37.094780 36.020779 35.029910 34.028926 33.096376
## 41 40.149524 39.588371 38.614218 37.446653 36.262219 35.324039 34.084627
## 42 41.006827 40.193924 39.217453 38.118481 37.028960 36.052069 35.023055
## 43 42.341627 41.039751 40.035293 39.104277 38.236009 37.191217 36.541591
## 44 43.031354 42.169989 41.185280 40.085565 39.046301 38.060168 37.016246
## 45 44.148054 43.019055 42.014307 41.011932 40.083150 39.057802 38.225884
## 46 45.056493 44.284803 43.286990 42.182965 41.093778 40.119292 39.006490
## 47 46.028608 45.103499 44.111929 43.041676 42.022546 41.026916 40.033697
## 48 47.091151 46.008542 45.019725 44.001789 43.041783 42.025865 41.177304
## 49 48.034170 47.055354 46.071653 45.014709 44.016646 43.015324 42.072692
## 50 49.043706 48.025713 47.041696 46.011875 45.010649 44.004912 43.122437
## 51 50.043448 49.293706 48.311380 47.200725 46.092996 45.124059 44.016570
## 52 51.062326 50.338751 49.367637 48.232902 47.131243 46.168748 45.023918
## 53 52.181314 51.009992 50.027758 49.040137 48.117281 47.092913 46.317329
## 54 53.293882 52.039311 51.038382 50.090029 49.205877 48.168723 47.441174
## 55 54.370371 53.858802 52.871916 51.731628 50.506811 49.577015 48.316770
##            8         9        10        11        12        13        14
## 2                                                                       
## 3                                                                       
## 4                                                                       
## 5                                                                       
## 6                                                                       
## 7                                                                       
## 8                                                                       
## 9   5.560890                                                            
## 10  5.831423  1.016858                                                  
## 11  4.814686  2.673219  2.058762                                        
## 12 12.489620  7.081236  6.718341  8.139128                              
## 13 10.078348  5.346232  4.603086  5.518107  3.638502                    
## 14  6.356257  8.961858  8.463918  6.444998 13.892861 10.798866          
## 15  7.959033  6.282110  5.323054  4.120218  8.744564  5.506478  5.920203
## 16 10.267940  7.152209  6.152374  5.759913  6.850898  3.803617  8.671989
## 17  9.003194  9.600583  8.791428  6.993418 12.686903  9.486517  3.717755
## 18 10.147034  9.780542  8.865743  7.336082 11.817187  8.639722  5.512830
## 19 11.178381 12.458391 11.680698  9.826841 15.449000 12.284213  5.023724
## 20 12.006981 12.397496 11.525524  9.856226 14.500255 11.441691  6.277340
## 21 13.008144 13.077962 12.166228 10.607629 14.663676 11.638647  7.432685
## 22 14.996750 13.019347 12.018744 11.135578 11.919702  9.631397 10.866678
## 23 16.462743 14.115977 13.119344 12.402157 12.147745 10.233914 12.532849
## 24 16.092470 15.464666 14.500459 13.163898 15.706769 13.100698 10.660947
## 25 17.549972 16.066512 15.077904 14.020981 15.021974 12.886784 12.639142
## 26 18.930821 17.026165 16.024291 15.160468 15.235203 13.333525 14.328042
## 27 19.310523 18.120304 17.125974 16.020471 17.227713 15.009704 14.109468
## 28 20.633230 19.031760 18.026949 17.085526 17.441170 15.455229 15.706572
## 29 21.106622 20.292481 19.307631 18.097152 19.640527 17.370636 15.568426
## 30 22.389922 21.041794 20.044119 19.008046 19.579632 17.648782 17.135945
## 31 23.223256 22.121490 21.131330 20.011612 20.885483 18.900045 17.757601
## 32 24.790260 23.016322 22.014734 21.150778 20.788819 19.189630 19.778458
## 33 25.311096 24.317634 23.349516 22.178282 23.050475 21.274113 19.681697
## 34 26.864155 25.034582 24.035334 23.199289 22.588107 21.130327 21.822103
## 35 27.619031 26.030836 25.031920 24.102114 23.800027 22.230879 22.371663
## 36 29.363276 27.245442 26.249909 25.532536 24.222168 23.011508 24.511638
## 37 29.291724 28.038734 27.040307 26.009812 26.170898 24.454955 23.793674
## 38 30.096488 29.171889 28.176748 27.048364 27.686090 25.799502 24.413681
## 39 31.055850 30.222510 29.231557 28.072086 28.809946 26.937455 25.290975
## 40 32.169946 31.089601 30.091240 29.025558 29.333796 27.590156 26.543195
## 41 33.916446 32.105439 31.107488 30.282459 29.283932 28.036819 28.708220
## 42 34.365731 33.028603 32.027135 31.041773 30.798807 29.250056 28.852125
## 43 35.009205 34.551305 33.571162 32.304507 33.419440 31.454060 29.030636
## 44 36.311618 35.011048 34.011094 33.024158 32.807112 31.298280 30.748070
## 45 37.041222 36.220472 35.229908 34.082457 34.591110 32.855517 31.206283
## 46 38.470194 37.010359 36.012738 35.072237 34.504388 33.160191 32.956802
## 47 39.206464 38.028651 37.030162 36.005425 35.877561 34.357399 33.540122
## 48 40.041832 39.173481 38.177653 37.056609 37.378904 35.684980 34.222669
## 49 41.129438 40.066909 39.067664 38.014257 38.009353 36.434978 35.400338
## 50 42.082344 41.122634 40.124097 39.034040 39.137135 37.513632 36.295803
## 51 43.474483 42.023408 41.022418 40.093679 39.384628 38.080053 37.933019
## 52 44.531249 43.028351 42.026225 41.128123 40.332695 39.057243 39.023028
## 53 45.007154 44.315483 43.321350 42.159681 42.620900 40.884948 39.092760
## 54 46.010237 45.441371 44.453529 43.248486 43.878119 42.123397 40.022283
## 55 48.179049 46.357622 45.365197 44.560514 43.105480 42.124870 42.826177
##           15        16        17        18        19        20        21
## 2                                                                       
## 3                                                                       
## 4                                                                       
## 5                                                                       
## 6                                                                       
## 7                                                                       
## 8                                                                       
## 9                                                                       
## 10                                                                      
## 11                                                                      
## 12                                                                      
## 13                                                                      
## 14                                                                      
## 15                                                                      
## 16  3.028267                                                            
## 17  4.169304  6.365053                                                  
## 18  3.675609  5.142888  1.890661                                        
## 19  7.021524  8.927049  2.922961  3.837330                              
## 20  6.427348  7.831488  3.047409  2.854242  2.015292                    
## 21  6.928290  7.921061  4.035381  3.314981  3.086551  1.254432          
## 22  7.252276  6.118554  7.225123  5.450761  7.926935  6.004340  5.203893
## 23  8.677021  7.048596  8.932726  7.163700  9.596421  7.688127  6.831976
## 24  9.257289  9.329480  7.169833  6.030249  6.203177  4.457892  3.360298
## 25 10.124026  9.342650  9.021807  7.552178  8.670035  6.805652  5.773448
## 26 11.254688 10.028858 10.653032  9.033023 10.495447  8.592462  7.506197
## 27 12.006977 11.434610 10.533556  9.176949  9.668883  7.919425  6.775094
## 28 13.082003 12.091261 12.057458 10.548626 11.436529  9.632642  8.462565
## 29 14.102010 13.744734 12.165443 11.018884 10.804291  9.303886  8.200396
## 30 15.020519 14.214049 13.600908 12.264791 12.589504 10.929090  9.806814
## 31 16.039875 15.399247 14.325345 13.114492 13.054133 11.525190 10.438592
## 32 17.191352 16.016504 16.174650 14.715213 15.359668 13.637008 12.495191
## 33 18.329610 17.785713 16.434144 15.388856 14.977510 13.592594 12.649664
## 34 19.251031 18.030785 18.235539 16.792448 17.351732 15.659093 14.527574
## 35 20.166817 19.038663 18.861872 17.510266 17.771210 16.195879 15.071214
## 36 21.656985 20.156582 20.891355 19.373459 20.136782 18.426535 17.277436
## 37 22.023531 21.137859 20.387898 19.160251 18.999376 17.562002 16.458891
## 38 23.046201 22.374034 21.123913 20.012204 19.501108 18.202467 17.127884
## 39 24.086752 23.480745 22.065532 21.012351 20.358148 19.113294 18.073345
## 40 25.007227 24.240528 23.218301 22.064807 21.652145 20.311046 19.230585
## 41 26.358701 25.054543 25.192733 23.815646 24.071504 22.513425 21.388424
## 42 27.063268 26.047236 25.464175 24.231211 24.024785 22.633049 21.527794
## 43 28.363469 27.928691 26.014917 25.122171 24.034954 23.008790 22.034455
## 44 29.019873 28.081189 27.388510 26.186361 25.885776 24.511026 23.427488
## 45 30.097457 29.454261 28.045470 27.025233 26.244037 25.068739 24.052582
## 46 31.109352 30.036125 29.577179 28.344903 28.137100 26.739046 25.656839
## 47 32.007096 31.116067 30.247173 29.100143 28.631060 27.333218 26.268544
## 48 33.058347 32.335626 31.046984 30.001283 29.250185 28.079254 27.043090
## 49 34.004425 33.167130 32.152655 31.041298 30.454765 29.212472 28.153918
## 50 35.042136 34.222640 33.094078 32.017008 31.333871 30.147738 29.096514
## 51 36.119495 35.005518 34.568306 33.338989 33.072755 31.714818 30.623310
## 52 37.131953 36.010461 35.637621 34.389318 34.163713 32.784342 31.684360
## 53 38.160651 37.510637 36.011990 35.031520 34.090026 33.017170 32.002826
## 54 39.275054 38.704071 37.016764 36.096892 35.020758 34.005954 33.025486
## 55 40.681495 39.286135 39.399750 38.085917 38.086428 36.656789 35.553990
##           22        23        24        25        26        27        28
## 2                                                                       
## 3                                                                       
## 4                                                                       
## 5                                                                       
## 6                                                                       
## 7                                                                       
## 8                                                                       
## 9                                                                       
## 10                                                                      
## 11                                                                      
## 12                                                                      
## 13                                                                      
## 14                                                                      
## 15                                                                      
## 16                                                                      
## 17                                                                      
## 18                                                                      
## 19                                                                      
## 20                                                                      
## 21                                                                      
## 22                                                                      
## 23  1.820110                                                            
## 24  4.214345  5.237891                                                  
## 25  3.293691  3.304149  2.861625                                        
## 26  4.038552  3.160554  4.652376  2.034527                              
## 27  5.415626  5.356249  3.498728  2.495516  2.770397                    
## 28  6.052892  5.411331  5.290784  3.438183  2.317110  2.003023          
## 29  7.786488  7.735981  5.043798  4.749716  4.933224  2.425943  3.216007
## 30  8.117838  7.547523  6.483348  5.074751  4.406926  3.118573  2.381428
## 31  9.301091  8.849740  7.158170  6.137239  5.748565  4.076604  3.750120
## 32 10.043092  9.067850  9.189810  7.320949  6.033672  5.738632  4.223790
## 33 11.760310 11.291683  9.448757  8.515791  8.325395  6.798860  6.650669
## 34 12.093581 11.058802 11.207283  9.372241  8.083823  7.763884  6.308661
## 35 13.027440 12.054227 11.761985 10.133055  9.022677  8.448278  7.172440
## 36 14.434137 13.170904 13.996893 11.959193 10.447038 10.570918  8.903797
## 37 15.055889 14.269198 13.228753 12.026030 11.145820 10.050065  9.085576
## 38 16.286101 15.657909 14.031557 13.196966 12.511675 11.058142 10.351126
## 39 17.387136 16.790792 15.002500 14.247698 13.642661 12.119039 11.509865
## 40 18.161110 17.442090 16.091103 15.116603 14.299734 13.008340 12.166388
## 41 19.163872 18.034145 18.081999 16.395054 15.131936 14.722547 13.350794
## 42 20.014055 19.090485 18.318649 17.050003 16.033287 15.127194 14.033592
## 43 21.856260 21.342533 19.150332 18.673106 18.215422 16.535214 16.083352
## 44 22.034389 21.159478 20.232192 19.048320 18.074717 17.052234 16.037494
## 45 23.353586 22.676380 21.011737 20.222685 19.535831 18.119967 17.421949
## 46 24.024265 23.042233 22.413848 21.068301 20.021793 19.199951 18.088615
## 47 25.051401 24.196010 23.115800 22.024284 21.104085 20.012449 19.056332
## 48 26.248055 25.503255 24.005122 23.159832 22.377835 21.063119 20.263832
## 49 27.098188 26.274893 25.054016 24.061671 23.170928 22.001686 21.087212
## 50 28.149970 27.332212 26.033338 25.092322 24.234403 23.043585 22.154004
## 51 29.021110 28.003432 27.415370 26.099280 25.007001 24.205066 23.059729
## 52 30.045349 29.030360 28.476662 27.157209 26.033845 25.234682 24.071919
## 53 31.427498 30.715787 29.051539 28.329762 27.586658 26.196988 25.448931
## 54 32.608769 31.941215 30.110020 29.465162 28.805737 27.341518 26.677622
## 55 33.462270 32.259118 32.281512 30.676416 29.435502 29.009011 27.685498
##           29        30        31        32        33        34        35
## 2                                                                       
## 3                                                                       
## 4                                                                       
## 5                                                                       
## 6                                                                       
## 7                                                                       
## 8                                                                       
## 9                                                                       
## 10                                                                      
## 11                                                                      
## 12                                                                      
## 13                                                                      
## 14                                                                      
## 15                                                                      
## 16                                                                      
## 17                                                                      
## 18                                                                      
## 19                                                                      
## 20                                                                      
## 21                                                                      
## 22                                                                      
## 23                                                                      
## 24                                                                      
## 25                                                                      
## 26                                                                      
## 27                                                                      
## 28                                                                      
## 29                                                                      
## 30  2.372910                                                            
## 31  2.408215  1.457189                                                  
## 32  5.147320  2.891159  3.270596                                        
## 33  5.088959  4.345872  3.188072  4.809615                              
## 34  6.878190  4.777384  4.697638  2.096235  5.083483                    
## 35  7.193052  5.371862  4.897581  3.209907  4.803280  1.845400          
## 36  9.825503  7.705855  7.679414  4.892627  7.753980  3.143724  3.353789
## 37  8.295047  7.023923  6.113959  5.437582  5.235580  4.038700  2.684325
## 38  9.018110  8.221873  7.107883  7.132755  6.030373  5.964478  4.669465
## 39 10.015643  9.303419  8.124026  8.285035  6.635360  7.046006  5.743509
## 40 11.064723 10.071683  9.055010  8.576934  7.744017  7.012560  5.858865
## 41 13.370512 11.633181 11.071942  9.183545  9.994914  7.151440  6.349394
## 42 13.379043 12.081535 11.219924 10.123147  9.932004  8.286887  7.071633
## 43 14.288593 13.873709 12.603888 12.985484 10.856325 11.677500 10.277047
## 44 15.234707 14.019465 13.108005 12.113422 11.555077 10.223737  9.204124
## 45 16.028169 15.244884 14.106803 13.857630 12.279963 12.208157 10.984052
## 46 17.477938 16.115980 15.262457 14.031158 13.605469 12.051017 11.042341
## 47 18.108084 17.003029 16.026291 15.171888 14.327666 13.294954 12.201783
## 48 19.004342 18.156770 17.070662 16.596153 15.348528 14.853373 13.636172
## 49 20.034046 19.031739 18.021185 17.269120 16.332798 15.422532 14.304132
## 50 21.037324 20.096350 19.056115 18.392626 17.373793 16.585919 15.363899
## 51 22.450724 21.137935 20.284923 19.015339 18.662559 17.028227 16.025929
## 52 23.494978 22.174104 21.343428 20.015631 19.760534 18.013037 17.094894
## 53 24.074235 23.343768 22.224853 21.834887 20.466634 20.096306 18.872228
## 54 25.173613 24.518758 23.351191 23.113180 21.454722 21.402582 20.150975
## 55 27.464838 25.910951 25.196666 23.543572 23.603500 21.514776 20.594409
##           36        37        38        39        40        41        42
## 2                                                                       
## 3                                                                       
## 4                                                                       
## 5                                                                       
## 6                                                                       
## 7                                                                       
## 8                                                                       
## 9                                                                       
## 10                                                                      
## 11                                                                      
## 12                                                                      
## 13                                                                      
## 14                                                                      
## 15                                                                      
## 16                                                                      
## 17                                                                      
## 18                                                                      
## 19                                                                      
## 20                                                                      
## 21                                                                      
## 22                                                                      
## 23                                                                      
## 24                                                                      
## 25                                                                      
## 26                                                                      
## 27                                                                      
## 28                                                                      
## 29                                                                      
## 30                                                                      
## 31                                                                      
## 32                                                                      
## 33                                                                      
## 34                                                                      
## 35                                                                      
## 36                                                                      
## 37  4.903540                                                            
## 38  6.805498  2.084490                                                  
## 39  7.753116  3.116970  1.370620                                        
## 40  7.088625  3.283763  2.267377  1.850838                              
## 41  5.156287  5.483630  6.291049  6.418107  4.968974                    
## 42  7.156235  5.118476  4.834822  4.514144  3.050623  3.080844          
## 43 11.820203  7.681582  5.910212  4.737510  5.028101  8.719398  5.762612
## 44  9.157238  7.087390  6.483595  5.792875  4.289009  4.571553  2.549686
## 45 11.737338  8.485505  7.148168  6.032603  5.361259  7.613685  4.879365
## 46 10.508825  9.220450  8.847712  8.166260  6.743323  5.405654  4.325887
## 47 12.106073 10.025153  9.173091  8.295493  7.069342  7.215435  5.267457
## 48 13.929777 11.253160 10.019466  9.016335  8.142094  9.271936  6.839313
## 49 14.221354 12.058914 11.039995 10.116061  9.004349  9.321363  7.321953
## 50 15.346436 13.117111 12.022907 11.089739 10.116417 10.455133  8.359749
## 51 15.200944 14.198922 13.629435 12.887331 11.538167 10.107017  9.127727
## 52 16.176579 15.263918 14.697391 13.959259 12.545609 11.120926 10.244208
## 53 19.052966 16.479023 15.150667 14.119210 13.344433 14.229947 11.997350
## 54 20.474948 17.722449 16.338797 15.236171 14.595044 15.657727 13.383856
## 55 19.198276 19.204596 18.979020 18.350008 16.968777 14.368469 14.217296
##           43        44        45        46        47        48        49
## 2                                                                       
## 3                                                                       
## 4                                                                       
## 5                                                                       
## 6                                                                       
## 7                                                                       
## 8                                                                       
## 9                                                                       
## 10                                                                      
## 11                                                                      
## 12                                                                      
## 13                                                                      
## 14                                                                      
## 15                                                                      
## 16                                                                      
## 17                                                                      
## 18                                                                      
## 19                                                                      
## 20                                                                      
## 21                                                                      
## 22                                                                      
## 23                                                                      
## 24                                                                      
## 25                                                                      
## 26                                                                      
## 27                                                                      
## 28                                                                      
## 29                                                                      
## 30                                                                      
## 31                                                                      
## 32                                                                      
## 33                                                                      
## 34                                                                      
## 35                                                                      
## 36                                                                      
## 37                                                                      
## 38                                                                      
## 39                                                                      
## 40                                                                      
## 41                                                                      
## 42                                                                      
## 43                                                                      
## 44  5.537870                                                            
## 45  3.082548  3.389616                                                  
## 46  7.275149  2.607182  4.637596                                        
## 47  6.173071  3.097773  3.225136  2.346529                              
## 48  5.626873  4.968813  3.157182  4.717637  2.455382                    
## 49  7.208058  5.233708  4.444142  4.247458  2.206830  1.753283          
## 50  7.751806  6.543753  5.372411  5.440891  3.578589  2.290371  1.656261
## 51 10.683562  7.328745  7.872395  5.125866  4.802447  5.530262  3.922193
## 52 11.760676  8.308977  8.874570  6.215296  5.797939  6.432993  4.710881
## 53 10.111948 10.073306  8.210871  9.145748  7.125875  5.256805  4.991693
## 54 11.013796 11.448655  9.317339 10.527170  8.516754  6.587746  6.475508
## 55 16.400518 12.828359 13.712538 10.322635 10.669011 11.376867  9.851736
##           50        51        52        53        54
## 2                                                   
## 3                                                   
## 4                                                   
## 5                                                   
## 6                                                   
## 7                                                   
## 8                                                   
## 9                                                   
## 10                                                  
## 11                                                  
## 12                                                  
## 13                                                  
## 14                                                  
## 15                                                  
## 16                                                  
## 17                                                  
## 18                                                  
## 19                                                  
## 20                                                  
## 21                                                  
## 22                                                  
## 23                                                  
## 24                                                  
## 25                                                  
## 26                                                  
## 27                                                  
## 28                                                  
## 29                                                  
## 30                                                  
## 31                                                  
## 32                                                  
## 33                                                  
## 34                                                  
## 35                                                  
## 36                                                  
## 37                                                  
## 38                                                  
## 39                                                  
## 40                                                  
## 41                                                  
## 42                                                  
## 43                                                  
## 44                                                  
## 45                                                  
## 46                                                  
## 47                                                  
## 48                                                  
## 49                                                  
## 50                                                  
## 51  4.013054                                        
## 52  4.853617  1.552675                              
## 53  3.850299  6.518420  6.648609                    
## 54  5.372448  7.904973  7.987428  1.805879          
## 55  9.501689  6.026583  5.680290 10.674413 11.543609

b) Clustering hierárquico de ligação única

hc2 <- hclust(d, method = "complete")
plot(hc2, main = "Dendograma de ligação completa")

Para essa comparação tem-se que a maioria dos clusters são similares ou seja, compotam-se de forma bem parecida. O que parece diferir é a altura no qual o de ligação completa é maior.

c)Supondo que você queira tentar diferentes valores de K (por exemplo, 2, 3, 4), calcule WCSS para diferentes valores de K

cd <- numeric(length = 10)

for (k in 1:10) {
  kr <- kmeans(dados[, 1:7], centers = k)
  cd[k] <- sum(kr$withinss)
}
plot(1:10, cd, type = "b", pch = 19, frame = FALSE,
     xlab = "Número K de cluster", ylab = "Soma de quadrados dentro do cluster",
     main = "Gráfico de cotovelo")
abline(v = which.min(-diff(cd)), col = "blue", lty = 1)

kr <- kmeans(dados[, 1:7], centers = 4)
cat(paste("K =", 4, "Clusters:", kr$cluster, "\n"))
## K = 4 Clusters: 1 
##  K = 4 Clusters: 1 
##  K = 4 Clusters: 1 
##  K = 4 Clusters: 1 
##  K = 4 Clusters: 1 
##  K = 4 Clusters: 1 
##  K = 4 Clusters: 1 
##  K = 4 Clusters: 1 
##  K = 4 Clusters: 1 
##  K = 4 Clusters: 1 
##  K = 4 Clusters: 1 
##  K = 4 Clusters: 1 
##  K = 4 Clusters: 1 
##  K = 4 Clusters: 1 
##  K = 4 Clusters: 1 
##  K = 4 Clusters: 3 
##  K = 4 Clusters: 3 
##  K = 4 Clusters: 3 
##  K = 4 Clusters: 3 
##  K = 4 Clusters: 3 
##  K = 4 Clusters: 3 
##  K = 4 Clusters: 3 
##  K = 4 Clusters: 3 
##  K = 4 Clusters: 3 
##  K = 4 Clusters: 3 
##  K = 4 Clusters: 3 
##  K = 4 Clusters: 3 
##  K = 4 Clusters: 3 
##  K = 4 Clusters: 3 
##  K = 4 Clusters: 2 
##  K = 4 Clusters: 2 
##  K = 4 Clusters: 2 
##  K = 4 Clusters: 2 
##  K = 4 Clusters: 2 
##  K = 4 Clusters: 2 
##  K = 4 Clusters: 2 
##  K = 4 Clusters: 2 
##  K = 4 Clusters: 2 
##  K = 4 Clusters: 2 
##  K = 4 Clusters: 2 
##  K = 4 Clusters: 2 
##  K = 4 Clusters: 2 
##  K = 4 Clusters: 4 
##  K = 4 Clusters: 4 
##  K = 4 Clusters: 4 
##  K = 4 Clusters: 4 
##  K = 4 Clusters: 4 
##  K = 4 Clusters: 4 
##  K = 4 Clusters: 4 
##  K = 4 Clusters: 4 
##  K = 4 Clusters: 4 
##  K = 4 Clusters: 4 
##  K = 4 Clusters: 4 
##  K = 4 Clusters: 4 
##  K = 4 Clusters: 4

Percebe-se que os métodos hierárquicos geram um número maior de clusters em comparação com este método.