HW 5

This is my homework five for DACSS 601

Karen Kimble
2022-04-29

From Last HW

Reading in the Dataset & Cleaining

SPI <- read_excel("/Users/karenkimble/Documents/R Practice/Social Progress Index.xlsx", sheet = "2011-2021 data")

SPI$...10 <- NULL
SPI$...23 <- NULL

colnames(SPI) <- c("Rank",
                   "Country",
                   "Code",
                   "Year",
                   "Status",
                   "SPI",
                   "Needs",
                   "Wellbeing",
                   "Opportunity",
                   "Nutrition/care",
                   "Sanitation",
                   "Shelter",
                   "Safety",
                   "Access-knowledge",
                   "Info-comm",
                   "Health",
                   "Environment",
                   "Rights",
                   "Choice",
                   "Inclusiveness",
                   "Advanced-ed",
                   "Infectious",
                   "Child mortality",
                   "Stunting",
                   "Maternal-mortality",
                   "Undernourishment",
                   "Improved-sanitation",
                   "Improved-water",
                   "Hygeine-deaths",
                   "Pollution-deaths",
                   "Housing",
                   "Electricity",
                   "Clean-fuels",
                   "Personal-violence-deaths",
                   "Transport",
                   "Criminality",
                   "Political-killings",
                   "Women-no-education",
                   "Education-access",
                   "Primary-enrollment",
                   "Secondary-attainment",
                   "Gender-gap-secondary",
                   "Online-governance",
                   "Internet-users",
                   "Media",
                   "Cellphone",
                   "Life-expectancy",
                   "Premature-deaths",
                   "Healthcare",
                   "Essential-services",
                   "Pollution",
                   "Lead",
                   "Particulate",
                   "Species",
                   "Justice",
                   "Expression",
                   "Religion",
                   "Political-rights",
                   "Property",
                   "Contraception",
                   "Corruption",
                   "Early-marriage",
                   "Youth-nonemployed",
                   "Vulnerable",
                   "Equal-gender",
                   "Equal-social",
                   "Equal-socioeconomic",
                   "Discrimination-violence",
                   "LGBT",
                   "Citable-docs",
                   "Academic",
                   "Women-advanced",
                   "Tertiary",
                   "Quality-unis")
View(SPI)

Summary Statistics

Because of the sheer amount of variables within this dataset, I will be only be focusing on one category of the SPI’s three major categories: Foundations of Wellbeing. The other two categories, Basic Needs and Opportunity, are still important and should be analyzed. However, I am primarily interested in the Foundations of Wellbeing category, which includes indicators related to access to knowledge and infrastructure as well as health, because it may be interesting to see if countries generally viewed as more “free” and democratic will do well in those categories (such as the United States or some European Union countries). There are still a lot of variables condensed into the Foundations of Wellbeing category, so I will analyze the main variables that are computed using their sub-categories. Those variables are: Access to Basic Knowledge, Access to Information and Communications, Health and Wellness, and Environmental Quality.

# Access to Knowledge

summarySE(SPI, measurevar="Access-knowledge", groupvars=c("Country"))
                          Country  N Access-knowledge        sd
1                         Albania 11         89.79818 3.1898929
2                         Algeria 11         73.41818 3.2575287
3                  American Samoa 11               NA        NA
4                         Andorra 11               NA        NA
5                          Angola 11         47.80091 1.8826548
6             Antigua and Barbuda 11               NA        NA
7                       Argentina 11         84.57364 0.5987699
8                         Armenia 11         93.78636 1.5730180
9                       Australia 11         94.97636 0.6425300
10                        Austria 11         96.26636 1.1831352
11                     Azerbaijan 11         85.30364 3.0429438
12                   Bahamas, The 11               NA        NA
13                        Bahrain 11         77.95364 2.5489735
14                     Bangladesh 11         60.45364 2.9819138
15                       Barbados 11         96.01364 0.8422151
16                        Belarus 11         95.25636 0.7660843
17                        Belgium 11         94.14364 0.7445041
18                         Belize 11               NA        NA
19                          Benin 11         52.16636 3.1420294
20                        Bermuda 11               NA        NA
21                         Bhutan 11         53.04455 6.8126403
22                        Bolivia 11         70.06636 2.1988965
23         Bosnia and Herzegovina 11         80.52182 4.6330961
24                       Botswana 11         82.61182 1.6348192
25                         Brazil 11         75.58091 2.1845756
26              Brunei Darussalam 11               NA        NA
27                       Bulgaria 11         90.19091 2.8178053
28                   Burkina Faso 11         28.23455 3.6659199
29                        Burundi 11         46.74364 1.6398003
30                     Cabo Verde 11         66.96454 1.2442933
31                       Cambodia 11         51.12000 1.4666699
32                       Cameroon 11         66.68818 2.5475587
33                         Canada 11         97.32727 0.7464722
34       Central African Republic 11         32.72818 1.9290561
35                           Chad 11         21.04273 3.2559638
36                          Chile 11         82.85545 0.8516839
37                          China 11         77.60091 2.4908683
38                       Colombia 11         77.09364 0.5161632
39                        Comoros 11         55.27182 2.6230702
40  Congo, Democratic Republic of 11         55.69000 5.0903303
41             Congo, Republic of 11         67.68727 2.7058497
42                   Cook Islands 11               NA        NA
43                     Costa Rica 11         87.01182 0.5798246
44                  Côte d'Ivoire 11         38.18000 7.8408790
45                        Croatia 11         94.54364 2.3721861
46                           Cuba 11         90.98273 1.4826065
47                         Cyprus 11         93.33818 0.8828463
48                        Czechia 11         98.36364 0.1183436
49                        Denmark 11         97.93818 0.6199972
50                       Djibouti 11         34.25909 2.8588648
51                       Dominica 11               NA        NA
52             Dominican Republic 11         73.93637 0.3824727
53                        Ecuador 11         82.96364 0.6525989
54                          Egypt 11         71.58182 3.8042176
55                    El Salvador 11         66.38091 1.6720138
56              Equatorial Guinea 11         47.25273 1.5509615
57                        Eritrea 11         42.52091 1.8703506
58                        Estonia 11         98.62000 0.3100956
59                       Eswatini 11         65.63818 2.0045398
60                       Ethiopia 11         41.31364 4.3955101
61                           Fiji 11         87.37273 1.5355983
62                        Finland 11         98.55273 1.2356143
63                         France 11         93.34000 0.5977782
64                          Gabon 11         68.42091 4.8518977
65                    Gambia, The 11         43.41818 7.0232442
66                        Georgia 11         94.75182 0.4048402
67                        Germany 11         96.71182 0.6264156
68                          Ghana 11         65.77727 4.0763029
69                         Greece 11         89.03273 0.8496954
70                      Greenland 11               NA        NA
71                        Grenada 11               NA        NA
72                           Guam 11               NA        NA
73                      Guatemala 11         62.89909 3.4238534
74                         Guinea 11         27.37364 2.8190330
75                  Guinea-Bissau 11         33.50273 5.0061927
76                         Guyana 11         77.53636 1.1825262
77                          Haiti 11         49.62909 1.9104476
78                       Honduras 11         61.61364 1.4538381
79                      Hong Kong 11               NA        NA
80                        Hungary 11         92.80545 0.9842897
81                        Iceland 11         98.81182 0.5468438
82                          India 11         56.30727 1.6813394
83                      Indonesia 11         71.77818 0.8722603
84                           Iran 11         78.95909 2.2459624
85                           Iraq 11         56.56182 3.4374255
86                        Ireland 11         94.76455 0.6217297
87                         Israel 11         89.79636 0.5203317
88                          Italy 11         90.72273 0.5348841
89                        Jamaica 11         84.65727 1.0090885
90                          Japan 11         97.95546 0.5169404
91                         Jordan 11         77.66909 1.6497659
92                     Kazakhstan 11         94.64818 0.1691642
93                          Kenya 11         63.73000 0.3682925
94                       Kiribati 11               NA        NA
95  Korea, Democratic Republic of 11               NA        NA
96             Korea, Republic of 11         91.35364 0.5454401
97                         Kosovo 11               NA        NA
98                         Kuwait 11         81.92364 1.9457662
99                     Kyrgyzstan 11         92.10909 0.9374164
100                          Laos 11         58.59182 2.4654774
101                        Latvia 11         96.46818 0.8043855
102                       Lebanon 11         80.73636 0.5364010
103                       Lesotho 11         76.10182 1.2572495
104                       Liberia 11         44.93000 1.5343791
105                         Libya 11         62.19909 1.5775205
106                     Lithuania 11         96.18818 0.3730091
107                    Luxembourg 11         98.16364 0.7734754
108                    Madagascar 11         63.54545 2.1821347
109                        Malawi 11         55.69455 3.1616776
110                      Malaysia 11         85.58182 2.6139208
111                      Maldives 11         68.70909 2.2634389
112                          Mali 11         26.09727 1.6474717
113                         Malta 11         91.71454 1.6295296
114              Marshall Islands 11               NA        NA
115                    Mauritania 11         39.21273 2.9702826
116                     Mauritius 11         85.49545 2.4047551
117                        Mexico 11         77.31545 1.8511533
118                    Micronesia 11               NA        NA
119                       Moldova 11         90.54727 0.6694048
120                        Monaco 11               NA        NA
121                      Mongolia 11         90.93545 0.4904158
122                    Montenegro 11         92.69182 0.7585349
123                       Morocco 11         55.51636 4.0032121
124                    Mozambique 11         46.31182 6.0665834
125                       Myanmar 11         57.31455 5.5425800
126                       Namibia 11         73.05818 1.6786545
127                         Nauru 11               NA        NA
128                         Nepal 11         49.95000 3.2891974
129                   Netherlands 11         95.09545 0.7414631
130                   New Zealand 11         97.34909 0.6794617
131                     Nicaragua 11         73.49818 2.0631182
132                         Niger 11         21.13000 3.4109381
133                       Nigeria 11         49.88182 2.3846207
134                          Niue 11               NA        NA
135      Northern Mariana Islands 11               NA        NA
136                        Norway 11         98.66091 0.2333431
137                          Oman 11         77.48455 1.6266374
138                      Pakistan 11         41.52364 3.1799188
139                         Palau 11               NA        NA
140                        Panama 11         81.32818 1.0672942
141              Papua New Guinea 11         46.62545 1.8081062
142                      Paraguay 11         69.89091 1.9347467
143                          Peru 11         75.81364 1.2504335
144                   Philippines 11         80.04364 1.0685346
145                        Poland 11         93.09909 0.7963838
146                      Portugal 11         87.86636 0.9745901
147                   Puerto Rico 11               NA        NA
148                         Qatar 11         83.17182 2.1946930
149   Republic of North Macedonia 11         75.93909 1.1403204
150                       Romania 11         86.54091 2.8033038
151                        Russia 11         93.60545 0.6037760
152                        Rwanda 11         61.28545 2.7062317
153                         Samoa 11               NA        NA
154                    San Marino 11               NA        NA
155         Sao Tome and Principe 11         65.57546 1.5987940
156                  Saudi Arabia 11         77.75636 4.0028228
157                       Senegal 11         37.19727 1.4542972
158                        Serbia 11         90.46273 1.4031544
159                    Seychelles 11         89.83454 0.6601571
160                  Sierra Leone 11         48.22545 3.2533839
161                     Singapore 11         89.82636 0.9552942
162                      Slovakia 11         91.71455 0.3828145
163                      Slovenia 11         98.49455 1.0611638
164               Solomon Islands 11         58.43909 3.1295279
165                       Somalia 11         22.59364 1.5078151
166                  South Africa 11         78.82091 1.0600900
167                   South Sudan 11         27.33000 0.7296301
168                         Spain 11         88.57636 0.7425805
169                     Sri Lanka 11         86.73636 1.8138483
170            St Kitts and Nevis 11               NA        NA
171                      St Lucia 11               NA        NA
172 St Vincent and the Grenadines 11               NA        NA
173                         Sudan 11         37.41818 3.6240663
174                      Suriname 11         77.58182 0.6612527
175                        Sweden 11         94.03273 0.5843824
176                   Switzerland 11         98.43182 0.3782009
177                         Syria 11         58.80273 4.4209420
178                        Taiwan 11               NA        NA
179                    Tajikistan 11         86.74545 1.0454701
180                      Tanzania 11         55.89909 2.8227411
181                      Thailand 11         76.45818 0.6688022
182                   Timor-Leste 11         54.37636 2.8325259
183                          Togo 11         57.54364 2.5228202
184                       Tokelau 11               NA        NA
185                         Tonga 11               NA        NA
186           Trinidad and Tobago 11         89.90818 0.9800383
187                       Tunisia 11         68.89909 1.9695662
188                        Turkey 11         70.29636 2.0020760
189                  Turkmenistan 11         86.37455 1.4286252
190                        Tuvalu 11               NA        NA
191                        Uganda 11         62.76091 2.5668956
192                       Ukraine 11         91.76455 1.0896826
193          United Arab Emirates 11         83.81091 3.7595050
194                United Kingdom 11         93.35727 1.6374017
195                 United States 11         92.78273 0.2913448
196                       Uruguay 11         86.29182 0.7359989
197                    Uzbekistan 11         92.58545 0.9629567
198                       Vanuatu 11         75.14818 0.8629345
199                       Vietnam 11         85.38636 0.7787330
200           Virgin Islands (US) 11               NA        NA
201            West Bank and Gaza 11         81.50818 4.0646287
202                         World 11         70.50636 1.3558634
203                         Yemen 11         37.02091 4.1719048
204                        Zambia 11         59.87909 1.7431725
205                      Zimbabwe 11         79.00091 1.7164705
            se         ci
1   0.96178890 2.14299922
2   0.98218185 2.18843753
3           NA         NA
4           NA         NA
5   0.56764178 1.26478470
6           NA         NA
7   0.18053592 0.40225910
8   0.47428277 1.05676786
9   0.19373008 0.43165753
10  0.35672869 0.79484104
11  0.91748208 2.04427747
12          NA         NA
13  0.76854443 1.71242370
14  0.89908084 2.00327696
15  0.25393741 0.56580781
16  0.23098311 0.51466244
17  0.22447642 0.50016463
18          NA         NA
19  0.94735750 2.11084405
20          NA         NA
21  2.05408833 4.57679401
22  0.66299225 1.47723879
23  1.39693103 3.11255631
24  0.49291655 1.09828651
25  0.65867432 1.46761784
26          NA         NA
27  0.84960027 1.89302738
28  1.10531644 2.46279850
29  0.49441841 1.10163286
30  0.37516854 0.83592759
31  0.44221761 0.98532224
32  0.76811784 1.71147320
33  0.22506985 0.50148687
34  0.58163231 1.29595755
35  0.98171003 2.18738627
36  0.25679236 0.57216903
37  0.75102504 1.67338807
38  0.15562906 0.34676316
39  0.79088541 1.76220251
40  1.53479232 3.41973040
41  0.81584438 1.81781455
42          NA         NA
43  0.17482370 0.38953147
44  2.36411397 5.26757419
45  0.71524102 1.59365631
46  0.44702267 0.99602858
47  0.26618818 0.59310423
48  0.03568193 0.07950429
49  0.18693620 0.41651980
50  0.86198016 1.92061148
51          NA         NA
52  0.11531986 0.25694867
53  0.19676598 0.43842192
54  1.14701477 2.55570818
55  0.50413112 1.12327414
56  0.46763248 1.04195009
57  0.56393191 1.25651860
58  0.09349735 0.20832509
59  0.60439148 1.34666813
60  1.32529616 2.95294386
61  0.46300031 1.03162897
62  0.37255173 0.83009698
63  0.18023690 0.40159284
64  1.46290219 3.25954920
65  2.11758780 4.71827965
66  0.12206392 0.27197536
67  0.18887141 0.42083173
68  1.22905158 2.73849758
69  0.25619280 0.57083314
70          NA         NA
71          NA         NA
72          NA         NA
73  1.03233066 2.30017604
74  0.84997042 1.89385212
75  1.50942390 3.36320604
76  0.35654507 0.79443193
77  0.57602162 1.28345615
78  0.43834867 0.97670170
79          NA         NA
80  0.29677451 0.66125481
81  0.16487960 0.36737464
82  0.50694291 1.12953919
83  0.26299637 0.58599243
84  0.67718313 1.50885805
85  1.03642278 2.30929386
86  0.18745856 0.41768371
87  0.15688592 0.34956362
88  0.16127363 0.35934004
89  0.30425162 0.67791486
90  0.15586339 0.34728526
91  0.49742313 1.10832781
92  0.05100493 0.11364607
93  0.11104437 0.24742228
94          NA         NA
95          NA         NA
96  0.16445637 0.36643163
97          NA         NA
98  0.58667059 1.30718353
99  0.28264169 0.62976493
100 0.74336939 1.65633023
101 0.24253134 0.54039350
102 0.16173098 0.36035908
103 0.37907500 0.84463174
104 0.46263270 1.03080990
105 0.47564033 1.05979270
106 0.11246647 0.25059091
107 0.23321162 0.51962787
108 0.65793836 1.46597802
109 0.95328167 2.12404393
110 0.78812676 1.75605586
111 0.68245252 1.52059897
112 0.49673139 1.10678652
113 0.49132167 1.09473291
114         NA         NA
115 0.89557389 1.99546298
116 0.72506094 1.61553645
117 0.55814371 1.24362169
118         NA         NA
119 0.20183314 0.44971225
120         NA         NA
121 0.14786593 0.32946581
122 0.22870687 0.50959067
123 1.20701386 2.68939447
124 1.82914371 4.07558616
125 1.67115076 3.72355593
126 0.50613337 1.12773543
127         NA         NA
128 0.99173033 2.20971287
129 0.22355954 0.49812170
130 0.20486541 0.45646858
131 0.62205354 1.38602166
132 1.02843654 2.29149941
133 0.71899020 1.60201000
134         NA         NA
135         NA         NA
136 0.07035560 0.15676205
137 0.49044962 1.09278984
138 0.95878160 2.13629852
139         NA         NA
140 0.32180130 0.71701798
141 0.54516455 1.21470231
142 0.58334808 1.29978051
143 0.37701988 0.84005265
144 0.32217530 0.71785129
145 0.24011874 0.53501789
146 0.29384997 0.65473853
147         NA         NA
148 0.66172484 1.47441482
149 0.34381953 0.76607765
150 0.84522789 1.88328509
151 0.18204530 0.40562220
152 0.81595957 1.81807121
153         NA         NA
154         NA         NA
155 0.48205454 1.07408444
156 1.20689648 2.68913294
157 0.43848710 0.97701014
158 0.42306696 0.94265193
159 0.19904487 0.44349960
160 0.98093216 2.18565306
161 0.28803203 0.64177536
162 0.11542291 0.25717827
163 0.31995293 0.71289955
164 0.94358818 2.10244548
165 0.45462335 1.01296396
166 0.31962915 0.71217812
167 0.21999175 0.49017216
168 0.22389646 0.49887239
169 0.54689583 1.21855985
170         NA         NA
171         NA         NA
172         NA         NA
173 1.09269710 2.43468086
174 0.19937519 0.44423560
175 0.17619793 0.39259345
176 0.11403186 0.25407881
177 1.33296418 2.97002928
178         NA         NA
179 0.31522111 0.70235639
180 0.85108847 1.89634329
181 0.20165144 0.44930740
182 0.85403870 1.90291682
183 0.76065890 1.69485365
184         NA         NA
185         NA         NA
186 0.29549266 0.65839867
187 0.59384655 1.32317256
188 0.60364862 1.34501293
189 0.43074671 0.95976347
190         NA         NA
191 0.77394815 1.72446395
192 0.32855167 0.73205874
193 1.13353341 2.52566984
194 0.49369519 1.10002144
195 0.08784377 0.19572812
196 0.22191202 0.49445079
197 0.29034238 0.64692314
198 0.26018454 0.57972728
199 0.23479685 0.52315998
200         NA         NA
201 1.22553166 2.73065471
202 0.40880819 0.91088140
203 1.25787662 2.80272376
204 0.52558627 1.17107919
205 0.51753534 1.15314059
# If I wanted to look at each country's score as an average all scores

SPI %>%
  group_by(`Country`) %>%
  dplyr::summarise(mean = mean(`Access-knowledge`))
# A tibble: 205 × 2
   Country              mean
   <chr>               <dbl>
 1 Albania              89.8
 2 Algeria              73.4
 3 American Samoa       NA  
 4 Andorra              NA  
 5 Angola               47.8
 6 Antigua and Barbuda  NA  
 7 Argentina            84.6
 8 Armenia              93.8
 9 Australia            95.0
10 Austria              96.3
# … with 195 more rows
# Access to Information & Communications

summarySE(SPI, measurevar="Info-comm", groupvars=c("Country"))
                          Country  N Info-comm        sd        se
1                         Albania 11 66.801818  9.827059 2.9629699
2                         Algeria 11 45.510909  5.884117 1.7741279
3                  American Samoa 11        NA        NA        NA
4                         Andorra 11        NA        NA        NA
5                          Angola 11 29.800000  7.587359 2.2876748
6             Antigua and Barbuda 11        NA        NA        NA
7                       Argentina 11 71.663637  9.979380 3.0088962
8                         Armenia 11 60.273636 14.826002 4.4702077
9                       Australia 11 92.228182  2.770895 0.8354563
10                        Austria 11 84.960909  6.621803 1.9965488
11                     Azerbaijan 11 61.018182 11.843858 3.5710575
12                   Bahamas, The 11        NA        NA        NA
13                        Bahrain 11 74.641818  4.810397 1.4503892
14                     Bangladesh 11 45.288182 14.467276 4.3620479
15                       Barbados 11 70.760909  8.653914 2.6092533
16                        Belarus 11 59.132727 12.680568 3.8233350
17                        Belgium 11 83.478183  6.431906 1.9392927
18                         Belize 11        NA        NA        NA
19                          Benin 11 43.671818  6.061973 1.8277536
20                        Bermuda 11        NA        NA        NA
21                         Bhutan 11 52.334545 13.542376 4.0831799
22                        Bolivia 11 56.540910  9.885729 2.9806595
23         Bosnia and Herzegovina 11 60.578181 10.743072 3.2391581
24                       Botswana 11 54.880909  7.765091 2.3412632
25                         Brazil 11 75.220909  8.044118 2.4253930
26              Brunei Darussalam 11        NA        NA        NA
27                       Bulgaria 11 69.113636 10.209698 3.0783398
28                   Burkina Faso 11 42.892728 14.778085 4.4557604
29                        Burundi 11 17.472727  7.085940 2.1364911
30                     Cabo Verde 11 58.617274  9.222828 2.7807873
31                       Cambodia 11 40.030000  8.948485 2.6980697
32                       Cameroon 11 36.806364  8.868500 2.6739533
33                         Canada 11 85.517273  5.798995 1.7484628
34       Central African Republic 11 19.194546  4.433561 1.3367691
35                           Chad 11 18.242727  3.567086 1.0755168
36                          Chile 11 81.260910  8.572381 2.5846702
37                          China 11 56.286363 13.471490 4.0618071
38                       Colombia 11 76.465455  7.983108 2.4069977
39                        Comoros 11 26.375454  4.994504 1.5058995
40  Congo, Democratic Republic of 11 18.617273  5.508771 1.6609571
41             Congo, Republic of 11 35.154545  3.009653 0.9074444
42                   Cook Islands 11        NA        NA        NA
43                     Costa Rica 11 71.380909 14.588409 4.3985708
44                  Côte d'Ivoire 11 45.909090  8.816817 2.6583703
45                        Croatia 11 74.899091  6.492537 1.9575734
46                           Cuba 11 24.951818 13.154004 3.9660815
47                         Cyprus 11 75.611817  9.658722 2.9122144
48                        Czechia 11 74.647272  5.829893 1.7577788
49                        Denmark 11 91.058181  5.706691 1.7206320
50                       Djibouti 11 19.629091 12.241085 3.6908259
51                       Dominica 11        NA        NA        NA
52             Dominican Republic 11 64.100909  8.464146 2.5520360
53                        Ecuador 11 60.982727  9.645827 2.9083263
54                          Egypt 11 54.494546  7.061709 2.1291853
55                    El Salvador 11 61.411819  7.273598 2.1930723
56              Equatorial Guinea 11 22.260000  3.930687 1.1851467
57                        Eritrea 11  4.879091  1.841676 0.5552861
58                        Estonia 11 89.744547  4.200659 1.2665464
59                       Eswatini 11 38.763637  9.155263 2.7604158
60                       Ethiopia 11 24.318182 13.265591 3.9997263
61                           Fiji 11 49.979091 12.238518 3.6900521
62                        Finland 11 89.757274  5.584453 1.6837760
63                         France 11 87.611818  6.135723 1.8499902
64                          Gabon 11 51.201818  5.996060 1.8078802
65                    Gambia, The 11 40.715455 10.806696 3.2583414
66                        Georgia 11 65.191818 13.473306 4.0623547
67                        Germany 11 88.414545  2.927639 0.8827164
68                          Ghana 11 57.670000 12.825333 3.8669835
69                         Greece 11 75.334546  8.175562 2.4650248
70                      Greenland 11        NA        NA        NA
71                        Grenada 11        NA        NA        NA
72                           Guam 11        NA        NA        NA
73                      Guatemala 11 58.405454  8.019098 2.4178491
74                         Guinea 11 38.957273 12.334356 3.7189482
75                  Guinea-Bissau 11 31.375455  4.738047 1.4285749
76                         Guyana 11 47.650909  7.176544 2.1638095
77                          Haiti 11 34.346364  8.283163 2.4974677
78                       Honduras 11 51.797272  4.199007 1.2660483
79                      Hong Kong 11        NA        NA        NA
80                        Hungary 11 73.321818  3.580013 1.0794144
81                        Iceland 11 83.173637  8.253979 2.4886683
82                          India 11 51.775455 10.799029 3.2560296
83                      Indonesia 11 56.974545 10.303296 3.1065608
84                           Iran 11 46.862727 13.957534 4.2083550
85                           Iraq 11 49.124545 12.617603 3.8043503
86                        Ireland 11 82.962727  8.581341 2.5873716
87                         Israel 11 80.309091  5.810737 1.7520031
88                          Italy 11 78.037273 10.864564 3.2757893
89                        Jamaica 11 60.538182  6.277933 1.8928681
90                          Japan 11 89.801819  4.448747 1.3413478
91                         Jordan 11 55.193636  7.822102 2.3584526
92                     Kazakhstan 11 70.747273  7.818192 2.3572736
93                          Kenya 11 49.105454 11.208553 3.3795060
94                       Kiribati 11        NA        NA        NA
95  Korea, Democratic Republic of 11  3.374545  1.871397 0.5642475
96             Korea, Republic of 11 93.100000  3.565774 1.0751212
97                         Kosovo 11        NA        NA        NA
98                         Kuwait 11 71.987273 10.667591 3.2163996
99                     Kyrgyzstan 11 60.403636  7.175585 2.1635203
100                          Laos 11 28.204546  3.350407 1.0101857
101                        Latvia 11 78.930909  6.904168 2.0816851
102                       Lebanon 11 55.780000  7.573882 2.2836114
103                       Lesotho 11 41.310000 10.418320 3.1412416
104                       Liberia 11 34.433636  9.126371 2.7517044
105                         Libya 11 46.887273  3.261626 0.9834172
106                     Lithuania 11 81.530909  4.594324 1.3852407
107                    Luxembourg 11 86.350001  7.821778 2.3583548
108                    Madagascar 11 26.498182  6.272089 1.8911059
109                        Malawi 11 26.956364  7.574918 2.2839238
110                      Malaysia 11 72.862727  8.070103 2.4332276
111                      Maldives 11 56.833636  7.575763 2.2841786
112                          Mali 11 42.866364  8.066284 2.4320763
113                         Malta 11 78.396364  7.863685 2.3709902
114              Marshall Islands 11        NA        NA        NA
115                    Mauritania 11 44.614546  5.150500 1.5529341
116                     Mauritius 11 65.926364 11.142408 3.3595625
117                        Mexico 11 67.737272 11.323664 3.4142132
118                    Micronesia 11        NA        NA        NA
119                       Moldova 11 67.052727 15.061666 4.5412631
120                        Monaco 11        NA        NA        NA
121                      Mongolia 11 64.902728  7.186159 2.1667085
122                    Montenegro 11 69.510000 10.246367 3.0893960
123                       Morocco 11 67.232726  9.785489 2.9504360
124                    Mozambique 11 34.440000  8.370687 2.5238571
125                       Myanmar 11 28.559091 21.024274 6.3390570
126                       Namibia 11 52.752727  8.580899 2.5872383
127                         Nauru 11        NA        NA        NA
128                         Nepal 11 48.735454 16.794719 5.0637984
129                   Netherlands 11 94.563637  4.332968 1.3064389
130                   New Zealand 11 90.642727  5.134834 1.5482106
131                     Nicaragua 11 45.681818  6.710109 2.0231739
132                         Niger 11 26.555454  5.207153 1.5700158
133                       Nigeria 11 47.876364 10.948784 3.3011825
134                          Niue 11        NA        NA        NA
135      Northern Mariana Islands 11        NA        NA        NA
136                        Norway 11 91.384546  4.664872 1.4065118
137                          Oman 11 65.825455 12.892709 3.8872981
138                      Pakistan 11 42.015455  4.951360 1.4928912
139                         Palau 11        NA        NA        NA
140                        Panama 11 65.559091  8.565688 2.5826520
141              Papua New Guinea 11 26.931818  5.956438 1.7959337
142                      Paraguay 11 63.798182 12.036507 3.6291433
143                          Peru 11 70.490909  9.175049 2.7663814
144                   Philippines 11 66.101818 11.069628 3.3376186
145                        Poland 11 76.559999  7.407314 2.2333891
146                      Portugal 11 78.170000  9.022171 2.7202869
147                   Puerto Rico 11        NA        NA        NA
148                         Qatar 11 71.520910  9.153474 2.7598761
149   Republic of North Macedonia 11 66.685456 11.342397 3.4198614
150                       Romania 11 69.197273 10.304458 3.1069109
151                        Russia 11 67.834546 10.880587 3.2806205
152                        Rwanda 11 40.912727 14.916472 4.4974854
153                         Samoa 11        NA        NA        NA
154                    San Marino 11        NA        NA        NA
155         Sao Tome and Principe 11 42.016364  6.805073 2.0518068
156                  Saudi Arabia 11 64.753637 11.551356 3.4828650
157                       Senegal 11 52.845455 13.730655 4.1399484
158                        Serbia 11 62.587273 10.560955 3.1842477
159                    Seychelles 11 61.552728  8.272260 2.4941803
160                  Sierra Leone 11 37.263637 13.472368 4.0620719
161                     Singapore 11 80.037274  4.108035 1.2386191
162                      Slovakia 11 78.022728  8.571181 2.5843083
163                      Slovenia 11 78.244546  6.970668 2.1017354
164               Solomon Islands 11 34.830909  9.526480 2.8723419
165                       Somalia 11 22.414545  6.245297 1.8830278
166                  South Africa 11 64.605455 10.626680 3.2040646
167                   South Sudan 11 11.370000  1.421506 0.4286003
168                         Spain 11 86.133637  6.284016 1.8947021
169                     Sri Lanka 11 54.420909 12.795304 3.8579295
170            St Kitts and Nevis 11        NA        NA        NA
171                      St Lucia 11        NA        NA        NA
172 St Vincent and the Grenadines 11        NA        NA        NA
173                         Sudan 11 33.746364  7.090185 2.1377712
174                      Suriname 11 57.191818  4.896961 1.4764893
175                        Sweden 11 89.920908  4.285497 1.2921261
176                   Switzerland 11 83.044545  7.668331 2.3120888
177                         Syria 11 36.005454 11.920020 3.5940211
178                        Taiwan 11        NA        NA        NA
179                    Tajikistan 11 38.946364  7.259409 2.1887940
180                      Tanzania 11 39.924546 11.116013 3.3516040
181                      Thailand 11 56.039091 10.065653 3.0349084
182                   Timor-Leste 11 43.425455 14.621031 4.4084067
183                          Togo 11 37.044546 10.374589 3.1280564
184                       Tokelau 11        NA        NA        NA
185                         Tonga 11        NA        NA        NA
186           Trinidad and Tobago 11 69.255454  9.542548 2.8771864
187                       Tunisia 11 70.064545  9.854519 2.9712492
188                        Turkey 11 60.338182 10.680389 3.2202585
189                  Turkmenistan 11 33.300909  8.704043 2.6243678
190                        Tuvalu 11        NA        NA        NA
191                        Uganda 11 37.226364  9.503564 2.8654324
192                       Ukraine 11 63.779090 11.097601 3.3460527
193          United Arab Emirates 11 75.191819 10.333852 3.1157735
194                United Kingdom 11 94.078182  2.974908 0.8969685
195                 United States 11 89.124546  4.022251 1.2127543
196                       Uruguay 11 78.143635 11.222107 3.3835926
197                    Uzbekistan 11 47.503636 12.888372 3.8859904
198                       Vanuatu 11 42.941818  9.029949 2.7226319
199                       Vietnam 11 57.615456 10.465515 3.1554716
200           Virgin Islands (US) 11        NA        NA        NA
201            West Bank and Gaza 11 54.360000  8.537106 2.5740344
202                         World 11 60.173637  9.929886 2.9939733
203                         Yemen 11 27.696364  5.351148 1.6134318
204                        Zambia 11 35.218182  8.808050 2.6557269
205                      Zimbabwe 11 41.566364 12.362504 3.7274353
           ci
1    6.601908
2    3.953003
3          NA
4          NA
5    5.097257
6          NA
7    6.704238
8    9.960244
9    1.861513
10   4.448588
11   7.956812
12         NA
13   3.231669
14   9.719248
15   5.813779
16   8.518921
17   4.321013
18         NA
19   4.072489
20         NA
21   9.097892
22   6.641323
23   7.217294
24   5.216659
25   5.404112
26         NA
27   6.858969
28   9.928053
29   4.760399
30   6.195980
31   6.011674
32   5.957939
33   3.895818
34   2.978507
35   2.396401
36   5.759004
37   9.050270
38   5.363125
39   3.355353
40   3.700843
41   2.021912
42         NA
43   9.800627
44   5.923218
45   4.361745
46   8.836980
47   6.488818
48   3.916575
49   3.833807
50   8.223673
51         NA
52   5.686291
53   6.480155
54   4.744121
55   4.886470
56   2.640671
57   1.237254
58   2.822041
59   6.150590
60   8.911946
61   8.221949
62   3.751687
63   4.122035
64   4.028208
65   7.260037
66   9.051490
67   1.966815
68   8.616176
69   5.492417
70         NA
71         NA
72         NA
73   5.387304
74   8.286333
75   3.183063
76   4.821268
77   5.564705
78   2.820931
79         NA
80   2.405085
81   5.545099
82   7.254886
83   6.921849
84   9.376799
85   8.476621
86   5.765023
87   3.903706
88   7.298913
89   4.217573
90   2.988709
91   5.254960
92   5.252333
93   7.530009
94         NA
95   1.257222
96   2.395519
97         NA
98   7.166585
99   4.820624
100  2.250834
101  4.638283
102  5.088203
103  6.999122
104  6.131179
105  2.191190
106  3.086509
107  5.254742
108  4.213647
109  5.088899
110  5.421569
111  5.089467
112  5.419004
113  5.282895
114        NA
115  3.460153
116  7.485572
117  7.607341
118        NA
119 10.118565
120        NA
121  4.827727
122  6.883603
123  6.573981
124  5.623504
125 14.124299
126  5.764726
127        NA
128 11.282846
129  2.910927
130  3.449628
131  4.507912
132  3.498213
133  7.355493
134        NA
135        NA
136  3.133903
137  8.661440
138  3.326369
139        NA
140  5.754507
141  4.001590
142  8.086235
143  6.163882
144  7.436678
145  4.976301
146  6.061177
147        NA
148  6.149387
149  7.619926
150  6.922629
151  7.309678
152 10.021022
153        NA
154        NA
155  4.571711
156  7.760307
157  9.224380
158  7.094946
159  5.557380
160  9.050860
161  2.759815
162  5.758198
163  4.682958
164  6.399977
165  4.195647
166  7.139101
167  0.954981
168  4.221659
169  8.596003
170        NA
171        NA
172        NA
173  4.763251
174  3.289823
175  2.879036
176  5.151655
177  8.007978
178        NA
179  4.876937
180  7.467839
181  6.762197
182  9.822542
183  6.969744
184        NA
185        NA
186  6.410771
187  6.620356
188  7.175183
189  5.847456
190        NA
191  6.384581
192  7.455470
193  6.942376
194  1.998570
195  2.702185
196  7.539114
197  8.658526
198  6.066402
199  7.030829
200        NA
201  5.735306
202  6.670988
203  3.594950
204  5.917328
205  8.305243
# Looking at the average information and communications score for each country

SPI %>%
  group_by(`Country`) %>%
  dplyr::summarise(mean = mean(`Info-comm`))
# A tibble: 205 × 2
   Country              mean
   <chr>               <dbl>
 1 Albania              66.8
 2 Algeria              45.5
 3 American Samoa       NA  
 4 Andorra              NA  
 5 Angola               29.8
 6 Antigua and Barbuda  NA  
 7 Argentina            71.7
 8 Armenia              60.3
 9 Australia            92.2
10 Austria              85.0
# … with 195 more rows
# Health & Wellness

summarySE(SPI, measurevar="Health", groupvars=c("Country"))
                          Country  N   Health        sd         se
1                         Albania 11 72.41636 0.8142137 0.24549467
2                         Algeria 11 68.70818 1.5406599 0.46452643
3                  American Samoa 11       NA        NA         NA
4                         Andorra 11       NA        NA         NA
5                          Angola 11 41.53364 2.1846344 0.65869206
6             Antigua and Barbuda 11       NA        NA         NA
7                       Argentina 11 68.17727 0.5936504 0.17899234
8                         Armenia 11 65.99636 1.4739623 0.44441635
9                       Australia 11 86.54091 0.5312514 0.16017832
10                        Austria 11 85.67909 1.0793832 0.32544627
11                     Azerbaijan 11 45.59182 1.4763462 0.44513512
12                   Bahamas, The 11       NA        NA         NA
13                        Bahrain 11 71.06182 1.7754480 0.53531771
14                     Bangladesh 11 49.84182 2.5689250 0.77456004
15                       Barbados 11 72.95909 0.2582426 0.07786306
16                        Belarus 11 64.80636 3.1760180 0.95760547
17                        Belgium 11 84.93545 1.1367521 0.34274364
18                         Belize 11       NA        NA         NA
19                          Benin 11 51.25182 1.1723549 0.35347831
20                        Bermuda 11       NA        NA         NA
21                         Bhutan 11 63.99818 1.6496410 0.49738548
22                        Bolivia 11 54.30818 0.7276231 0.21938662
23         Bosnia and Herzegovina 11 65.65636 0.6153601 0.18553804
24                       Botswana 11 55.82455 1.3693094 0.41286231
25                         Brazil 11 65.44636 0.7574853 0.22839041
26              Brunei Darussalam 11       NA        NA         NA
27                       Bulgaria 11 61.02000 0.7438420 0.22427679
28                   Burkina Faso 11 44.79091 0.8983922 0.27087544
29                        Burundi 11 42.21182 0.5840175 0.17608790
30                     Cabo Verde 11 68.50000 1.7136344 0.51668021
31                       Cambodia 11 47.52909 0.9846773 0.29689136
32                       Cameroon 11 46.17818 2.8022057 0.84489681
33                         Canada 11 86.92727 0.5277136 0.15911165
34       Central African Republic 11 25.07818 1.0608661 0.31986316
35                           Chad 11 39.59000 1.4938341 0.45040791
36                          Chile 11 74.42818 1.1120690 0.33530141
37                          China 11 63.56636 1.4739218 0.44440413
38                       Colombia 11 71.90273 1.0398952 0.31354020
39                        Comoros 11 48.90455 2.7327874 0.82396640
40  Congo, Democratic Republic of 11 40.89636 1.7315667 0.52208701
41             Congo, Republic of 11 41.02909 1.9886149 0.59958997
42                   Cook Islands 11       NA        NA         NA
43                     Costa Rica 11 81.37727 0.4902886 0.14782758
44                  Côte d'Ivoire 11 43.46273 2.4742355 0.74601009
45                        Croatia 11 75.34455 1.1228125 0.33854070
46                           Cuba 11 74.52909 0.8355425 0.25192555
47                         Cyprus 11 82.72545 1.4754612 0.44486830
48                        Czechia 11 78.89364 1.4167502 0.42716625
49                        Denmark 11 83.21273 1.4637972 0.44135147
50                       Djibouti 11 45.56000 1.1069595 0.33376086
51                       Dominica 11       NA        NA         NA
52             Dominican Republic 11 57.36091 1.0562718 0.31847793
53                        Ecuador 11 68.85545 0.6107924 0.18416084
54                          Egypt 11 43.44364 1.2357845 0.37260306
55                    El Salvador 11 63.39818 1.0568995 0.31866719
56              Equatorial Guinea 11 50.32455 0.9527160 0.28725468
57                        Eritrea 11 42.24091 1.6754667 0.50517221
58                        Estonia 11 75.88091 1.9422180 0.58560075
59                       Eswatini 11 36.35273 4.6378273 1.39835754
60                       Ethiopia 11 47.55182 3.7836802 1.14082251
61                           Fiji 11 40.16455 2.1783446 0.65679560
62                        Finland 11 85.01091 0.8763942 0.26424281
63                         France 11 87.74091 0.6893687 0.20785248
64                          Gabon 11 51.60091 2.7182255 0.81957581
65                    Gambia, The 11 46.02545 0.9529363 0.28732112
66                        Georgia 11 60.83091 1.6549893 0.49899806
67                        Germany 11 83.60818 0.6812308 0.20539880
68                          Ghana 11 51.00636 1.8573065 0.55999897
69                         Greece 11 82.55727 0.4518638 0.13624207
70                      Greenland 11       NA        NA         NA
71                        Grenada 11       NA        NA         NA
72                           Guam 11       NA        NA         NA
73                      Guatemala 11 58.46455 0.5679143 0.17123260
74                         Guinea 11 36.08364 0.6025321 0.18167027
75                  Guinea-Bissau 11 33.11636 1.2108778 0.36509339
76                         Guyana 11 49.16545 1.5537657 0.46847799
77                          Haiti 11 34.42636 2.8034382 0.84526842
78                       Honduras 11 52.05273 1.3182874 0.39747861
79                      Hong Kong 11       NA        NA         NA
80                        Hungary 11 66.52455 0.9731739 0.29342297
81                        Iceland 11 89.57909 0.9309708 0.28069825
82                          India 11 47.87273 1.0427282 0.31439440
83                      Indonesia 11 52.14909 1.8978379 0.57221965
84                           Iran 11 71.49909 0.7750036 0.23367238
85                           Iraq 11 59.13909 1.5391647 0.46407561
86                        Ireland 11 83.04909 1.0022607 0.30219297
87                         Israel 11 85.83455 0.6019031 0.18148061
88                          Italy 11 87.68818 1.0721459 0.32326415
89                        Jamaica 11 66.30818 0.7513297 0.22653442
90                          Japan 11 90.72000 1.1219539 0.33828182
91                         Jordan 11 71.81273 1.7418801 0.52519662
92                     Kazakhstan 11 56.57636 3.3656030 1.01476747
93                          Kenya 11 51.00273 1.1622916 0.35044411
94                       Kiribati 11       NA        NA         NA
95  Korea, Democratic Republic of 11 52.54000 1.2598575 0.37986134
96             Korea, Republic of 11 87.28364 1.7955287 0.54137228
97                         Kosovo 11       NA        NA         NA
98                         Kuwait 11 82.84000 1.9303889 0.58203415
99                     Kyrgyzstan 11 55.94636 2.8960429 0.87318980
100                          Laos 11 42.45818 2.4098831 0.72660709
101                        Latvia 11 67.25909 1.9717576 0.59450728
102                       Lebanon 11 66.57000 0.9564410 0.28837782
103                       Lesotho 11 35.78273 1.9057965 0.57461927
104                       Liberia 11 45.46818 1.2255354 0.36951283
105                         Libya 11 60.39727 2.3375373 0.70479402
106                     Lithuania 11 69.94364 1.2432090 0.37484162
107                    Luxembourg 11 86.91000 1.3990704 0.42183560
108                    Madagascar 11 36.26000 1.1851159 0.35732590
109                        Malawi 11 45.03182 1.5508184 0.46758933
110                      Malaysia 11 66.85364 0.9108592 0.27463439
111                      Maldives 11 69.54636 1.0976182 0.33094432
112                          Mali 11 45.01909 0.4433392 0.13367179
113                         Malta 11 85.49636 1.2390033 0.37357356
114              Marshall Islands 11       NA        NA         NA
115                    Mauritania 11 50.96000 1.9081667 0.57533392
116                     Mauritius 11 68.59909 0.9883474 0.29799795
117                        Mexico 11 64.37455 0.4625666 0.13946906
118                    Micronesia 11       NA        NA         NA
119                       Moldova 11 58.99818 2.0150181 0.60755081
120                        Monaco 11       NA        NA         NA
121                      Mongolia 11 45.63182 2.6536905 0.80011779
122                    Montenegro 11 67.38273 0.5059076 0.15253687
123                       Morocco 11 53.64546 1.1146870 0.33609076
124                    Mozambique 11 37.46454 1.3759825 0.41487433
125                       Myanmar 11 45.09273 3.0484653 0.91914688
126                       Namibia 11 51.65455 1.7752088 0.53524558
127                         Nauru 11       NA        NA         NA
128                         Nepal 11 49.25636 0.8205159 0.24739486
129                   Netherlands 11 86.13455 0.8040695 0.24243607
130                   New Zealand 11 85.04182 0.9373654 0.28262630
131                     Nicaragua 11 65.60545 1.6225856 0.48922798
132                         Niger 11 45.37364 0.4313533 0.13005793
133                       Nigeria 11 50.25818 0.6136742 0.18502973
134                          Niue 11       NA        NA         NA
135      Northern Mariana Islands 11       NA        NA         NA
136                        Norway 11 87.84454 1.2736285 0.38401345
137                          Oman 11 64.76273 2.6218624 0.79052127
138                      Pakistan 11 38.43818 1.6540606 0.49871802
139                         Palau 11       NA        NA         NA
140                        Panama 11 76.34545 1.0397437 0.31349454
141              Papua New Guinea 11 18.00545 1.9339927 0.58312075
142                      Paraguay 11 60.31000 0.6806179 0.20521403
143                          Peru 11 70.41545 2.0701224 0.62416540
144                   Philippines 11 48.74818 0.6003133 0.18100127
145                        Poland 11 73.07909 1.1696703 0.35266885
146                      Portugal 11 82.86364 1.0181779 0.30699219
147                   Puerto Rico 11       NA        NA         NA
148                         Qatar 11 72.62545 2.0540768 0.61932745
149   Republic of North Macedonia 11 63.78636 0.6364006 0.19188199
150                       Romania 11 65.50182 1.1595841 0.34962775
151                        Russia 11 60.87091 3.1976931 0.96414075
152                        Rwanda 11 56.85546 1.4415367 0.43463967
153                         Samoa 11       NA        NA         NA
154                    San Marino 11       NA        NA         NA
155         Sao Tome and Principe 11 52.98364 0.8143865 0.24554677
156                  Saudi Arabia 11 67.84273 2.8285938 0.85285313
157                       Senegal 11 51.45000 1.1284235 0.34023247
158                        Serbia 11 64.15545 1.5148748 0.45675193
159                    Seychelles 11 65.27818 0.7051629 0.21261462
160                  Sierra Leone 11 42.86182 1.7345246 0.52297885
161                     Singapore 11 87.96364 1.7215820 0.51907651
162                      Slovakia 11 72.09000 1.5254622 0.45994415
163                      Slovenia 11 81.77818 1.0507691 0.31681880
164               Solomon Islands 11 29.26727 1.1774898 0.35502654
165                       Somalia 11 27.85182 1.0608093 0.31984605
166                  South Africa 11 51.80455 2.1048677 0.63464150
167                   South Sudan 11 36.09727 0.8600359 0.25931058
168                         Spain 11 86.78182 0.9851376 0.29703016
169                     Sri Lanka 11 70.27182 1.8734825 0.56487624
170            St Kitts and Nevis 11       NA        NA         NA
171                      St Lucia 11       NA        NA         NA
172 St Vincent and the Grenadines 11       NA        NA         NA
173                         Sudan 11 45.65909 2.3891858 0.72036662
174                      Suriname 11 61.26818 0.7198866 0.21705398
175                        Sweden 11 86.91636 0.6018683 0.18147012
176                   Switzerland 11 90.31909 0.9558707 0.28820586
177                         Syria 11 53.71636 2.4169497 0.72873775
178                        Taiwan 11 82.54818 0.8998864 0.27132597
179                    Tajikistan 11 46.47636 0.4441003 0.13390126
180                      Tanzania 11 53.43182 1.5950041 0.48091182
181                      Thailand 11 74.35091 0.6447556 0.19440114
182                   Timor-Leste 11 48.02000 0.8279372 0.24963247
183                          Togo 11 45.98545 2.3045454 0.69484658
184                       Tokelau 11       NA        NA         NA
185                         Tonga 11       NA        NA         NA
186           Trinidad and Tobago 11 66.60455 0.6300526 0.18996801
187                       Tunisia 11 68.47818 0.7033182 0.21205841
188                        Turkey 11 70.93273 0.8126761 0.24503106
189                  Turkmenistan 11 49.68364 0.7937418 0.23932217
190                        Tuvalu 11       NA        NA         NA
191                        Uganda 11 47.19364 1.3662086 0.41192738
192                       Ukraine 11 59.38636 1.1266877 0.33970911
193          United Arab Emirates 11 57.10273 2.9853851 0.90012749
194                United Kingdom 11 84.27364 0.5370527 0.16192748
195                 United States 11 75.82273 0.6660646 0.20082602
196                       Uruguay 11 72.87273 1.0850269 0.32714791
197                    Uzbekistan 11 45.67545 1.4241446 0.42939574
198                       Vanuatu 11 35.96545 1.2426046 0.37465939
199                       Vietnam 11 62.21545 1.3620901 0.41068563
200           Virgin Islands (US) 11       NA        NA         NA
201            West Bank and Gaza 11 62.64909 2.5893104 0.78070646
202                         World 11 59.00182 0.9149187 0.27585836
203                         Yemen 11 41.32182 1.1505717 0.34691041
204                        Zambia 11 44.62455 1.3143693 0.39629725
205                      Zimbabwe 11 36.73636 2.8026393 0.84502755
           ci
1   0.5469962
2   1.0350294
3          NA
4          NA
5   1.4676574
6          NA
7   0.3988198
8   0.9902213
9   0.3568995
10  0.7251395
11  0.9918229
12         NA
13  1.1927622
14  1.7258273
15  0.1734897
16  2.1336780
17  0.7636804
18         NA
19  0.7875988
20         NA
21  1.1082439
22  0.4888238
23  0.4134045
24  0.9199146
25  0.5088856
26         NA
27  0.4997198
28  0.6035481
29  0.3923483
30  1.1512352
31  0.6615152
32  1.8825474
33  0.3545229
34  0.7126995
35  1.0035714
36  0.7470981
37  0.9901941
38  0.6986111
39  1.8359116
40  1.1632823
41  1.3359697
42         NA
43  0.3293804
44  1.6622141
45  0.7543157
46  0.5613251
47  0.9912283
48  0.9517857
49  0.9833924
50  0.7436655
51         NA
52  0.7096130
53  0.4103359
54  0.8302113
55  0.7100347
56  0.6400433
57  1.1255938
58  1.3047998
59  3.1157348
60  2.5419109
61  1.4634318
62  0.5887697
63  0.4631242
64  1.8261287
65  0.6401913
66  1.1118370
67  0.4576570
68  1.2477555
69  0.3035663
70         NA
71         NA
72         NA
73  0.3815300
74  0.4047866
75  0.8134788
76  1.0438340
77  1.8833754
78  0.8856375
79         NA
80  0.6537871
81  0.6254347
82  0.7005144
83  1.2749848
84  0.5206545
85  1.0340249
86  0.6733279
87  0.4043640
88  0.7202774
89  0.5047501
90  0.7537389
91  1.1702110
92  2.2610428
93  0.7808381
94         NA
95  0.8463838
96  1.2062526
97         NA
98  1.2968529
99  1.9455881
100 1.6189815
101 1.3246448
102 0.6425458
103 1.2803315
104 0.8233259
105 1.5703789
106 0.8351992
107 0.9399083
108 0.7961717
109 1.0418540
110 0.6119236
111 0.7373899
112 0.2978393
113 0.8323738
114        NA
115 1.2819239
116 0.6639808
117 0.3107564
118        NA
119 1.3537076
120        NA
121 1.7827735
122 0.3398733
123 0.7488569
124 0.9243976
125 2.0479869
126 1.1926015
127        NA
128 0.5512301
129 0.5401812
130 0.6297306
131 1.0900679
132 0.2897871
133 0.4122719
134        NA
135        NA
136 0.8556353
137 1.7613911
138 1.1112130
139        NA
140 0.6985094
141 1.2992740
142 0.4572454
143 1.3907272
144 0.4032960
145 0.7857952
146 0.6840212
147        NA
148 1.3799475
149 0.4275397
150 0.7790192
151 2.1482395
152 0.9684375
153        NA
154        NA
155 0.5471123
156 1.9002752
157 0.7580852
158 1.0177067
159 0.4737349
160 1.1652695
161 1.1565745
162 1.0248194
163 0.7059163
164 0.7910484
165 0.7126614
166 1.4140694
167 0.5777800
168 0.6618244
169 1.2586227
170        NA
171        NA
172        NA
173 1.6050768
174 0.4836264
175 0.4043406
176 0.6421627
177 1.6237289
178 0.6045519
179 0.2983506
180 1.0715383
181 0.4331527
182 0.5562158
183 1.5482147
184        NA
185        NA
186 0.4232751
187 0.4724956
188 0.5459632
189 0.5332430
190        NA
191 0.9178314
192 0.7569191
193 2.0056090
194 0.3607969
195 0.4474683
196 0.7289310
197 0.9567533
198 0.8347931
199 0.9150646
200        NA
201 1.7395224
202 0.6146507
203 0.7729646
204 0.8830053
205 1.8828387
# Looking at the average health and wellness score of all years for each country

SPI %>%
  group_by(`Country`) %>%
  dplyr::summarise(mean = mean(`Health`))
# A tibble: 205 × 2
   Country              mean
   <chr>               <dbl>
 1 Albania              72.4
 2 Algeria              68.7
 3 American Samoa       NA  
 4 Andorra              NA  
 5 Angola               41.5
 6 Antigua and Barbuda  NA  
 7 Argentina            68.2
 8 Armenia              66.0
 9 Australia            86.5
10 Austria              85.7
# … with 195 more rows
# Environmental Quality

summarySE(SPI, measurevar="Environment", groupvars=c("Country"))
                          Country  N Environment        sd         se
1                         Albania 11    70.98000 0.9247067 0.27880957
2                         Algeria 11    51.70000 0.5673095 0.17105025
3                  American Samoa 11          NA        NA         NA
4                         Andorra 11          NA        NA         NA
5                          Angola 11    62.90182 0.4064680 0.12255471
6             Antigua and Barbuda 11          NA        NA         NA
7                       Argentina 11    78.00091 0.6484503 0.19551514
8                         Armenia 11    58.31636 1.8832431 0.56781917
9                       Australia 11    85.14273 1.3274577 0.40024356
10                        Austria 11    83.37091 1.2196992 0.36775315
11                     Azerbaijan 11    55.22000 0.9949376 0.29998498
12                   Bahamas, The 11    69.18273 1.0073543 0.30372874
13                        Bahrain 11    43.89545 2.9879138 0.90088991
14                     Bangladesh 11    44.91636 1.4462449 0.43605925
15                       Barbados 11    73.84818 0.8001219 0.24124582
16                        Belarus 11    71.28546 2.9983788 0.90404523
17                        Belgium 11    81.63364 1.4309184 0.43143813
18                         Belize 11    73.32636 0.9000263 0.27136815
19                          Benin 11    65.98091 1.2628417 0.38076109
20                        Bermuda 11          NA        NA         NA
21                         Bhutan 11    65.62000 0.6546308 0.19737862
22                        Bolivia 11    68.53364 0.9980406 0.30092056
23         Bosnia and Herzegovina 11    55.35909 1.8757322 0.56555454
24                       Botswana 11    63.50000 1.0069949 0.30362039
25                         Brazil 11    77.66364 1.4165254 0.42709849
26              Brunei Darussalam 11          NA        NA         NA
27                       Bulgaria 11    67.27273 1.7568618 0.52971378
28                   Burkina Faso 11    66.16364 1.3115047 0.39543356
29                        Burundi 11    63.80636 0.4963727 0.14966200
30                     Cabo Verde 11    67.38636 3.7135187 1.11966802
31                       Cambodia 11    69.04546 0.9804943 0.29563017
32                       Cameroon 11    47.68455 2.1171893 0.63835658
33                         Canada 11    91.92182 0.6466658 0.19497708
34       Central African Republic 11    58.68364 1.0863818 0.32755645
35                           Chad 11    57.92545 1.6861515 0.50839381
36                          Chile 11    78.33364 1.2372896 0.37305684
37                          China 11    38.22273 3.4039150 1.02631900
38                       Colombia 11    72.70727 1.8939331 0.57104233
39                        Comoros 11    72.40091 0.3377705 0.10184163
40  Congo, Democratic Republic of 11    64.68818 0.6939430 0.20923169
41             Congo, Republic of 11    59.91364 1.3698188 0.41301592
42                   Cook Islands 11          NA        NA         NA
43                     Costa Rica 11    76.50818 0.7549422 0.22762365
44                  Côte d'Ivoire 11    69.15636 0.8366142 0.25224866
45                        Croatia 11    74.85818 6.2155996 1.87407379
46                           Cuba 11    65.48273 1.8400383 0.55479241
47                         Cyprus 11    74.89455 1.9953614 0.60162410
48                        Czechia 11    79.83454 1.7518514 0.52820308
49                        Denmark 11    88.95727 1.1742404 0.35404682
50                       Djibouti 11    49.78636 1.8204850 0.54889687
51                       Dominica 11          NA        NA         NA
52             Dominican Republic 11    68.37636 0.5909192 0.17816883
53                        Ecuador 11    71.93182 1.6308457 0.49171847
54                          Egypt 11    24.03909 1.5283878 0.46082625
55                    El Salvador 11    58.84182 0.9687805 0.29209832
56              Equatorial Guinea 11    54.03182 2.0900618 0.63017735
57                        Eritrea 11    56.33455 0.7702128 0.23222790
58                        Estonia 11    89.60545 1.0791976 0.32539032
59                       Eswatini 11    62.97727 0.8922451 0.26902201
60                       Ethiopia 11    65.83546 0.3504377 0.10566095
61                           Fiji 11    69.77909 0.3793264 0.11437122
62                        Finland 11    94.43455 0.6617911 0.19953754
63                         France 11    86.33364 1.2430303 0.37478774
64                          Gabon 11    59.49182 0.4371001 0.13179063
65                    Gambia, The 11    60.12818 1.4316830 0.43166865
66                        Georgia 11    66.74364 1.3517640 0.40757219
67                        Germany 11    86.74091 1.0207672 0.30777290
68                          Ghana 11    64.97091 1.7389561 0.52431500
69                         Greece 11    78.04273 1.5640348 0.47157424
70                      Greenland 11          NA        NA         NA
71                        Grenada 11          NA        NA         NA
72                           Guam 11          NA        NA         NA
73                      Guatemala 11    60.75000 1.1499746 0.34673037
74                         Guinea 11    66.05000 0.6900721 0.20806455
75                  Guinea-Bissau 11    62.46909 0.7790307 0.23488660
76                         Guyana 11    54.65818 1.2887659 0.38857753
77                          Haiti 11    57.07909 1.0774546 0.32486480
78                       Honduras 11    62.54182 1.1270208 0.33980954
79                      Hong Kong 11          NA        NA         NA
80                        Hungary 11    77.87273 1.5716621 0.47387396
81                        Iceland 11    89.81545 0.8959965 0.27015310
82                          India 11    35.46364 0.6281448 0.18939279
83                      Indonesia 11    64.66273 0.5770108 0.17397532
84                           Iran 11    52.97091 0.9157562 0.27611089
85                           Iraq 11    33.53636 3.6047257 1.08686569
86                        Ireland 11    86.65000 1.1058838 0.33343651
87                         Israel 11    80.88909 1.5088172 0.45492552
88                          Italy 11    82.22091 1.2148938 0.36630426
89                        Jamaica 11    73.49727 0.5988687 0.18056572
90                          Japan 11    86.61364 0.8327463 0.25108247
91                         Jordan 11    56.15364 1.7705948 0.53385443
92                     Kazakhstan 11    66.54000 1.5714580 0.47381240
93                          Kenya 11    70.55636 0.5193897 0.15660189
94                       Kiribati 11          NA        NA         NA
95  Korea, Democratic Republic of 11    58.63364 0.9456557 0.28512593
96             Korea, Republic of 11    78.70909 1.4468350 0.43623717
97                         Kosovo 11          NA        NA         NA
98                         Kuwait 11    58.03909 2.4368231 0.73472982
99                     Kyrgyzstan 11    59.75545 1.3916702 0.41960436
100                          Laos 11    67.39909 1.1763119 0.35467137
101                        Latvia 11    81.72273 2.3621132 0.71220394
102                       Lebanon 11    52.77455 1.2472157 0.37604967
103                       Lesotho 11    50.24455 0.9795649 0.29534993
104                       Liberia 11    67.28000 0.5783946 0.17439253
105                         Libya 11    55.98364 1.0747958 0.32406313
106                     Lithuania 11    84.20545 1.9199445 0.57888506
107                    Luxembourg 11    86.14818 1.5160715 0.45711277
108                    Madagascar 11    64.59182 0.2863496 0.08633767
109                        Malawi 11    71.44636 0.6474909 0.19522586
110                      Malaysia 11    71.22000 1.2728547 0.38378013
111                      Maldives 11    77.90636 1.3429912 0.40492708
112                          Mali 11    65.42909 0.7724691 0.23290818
113                         Malta 11    74.05091 1.8523353 0.55850012
114              Marshall Islands 11          NA        NA         NA
115                    Mauritania 11    50.85182 1.3662052 0.41192637
116                     Mauritius 11    76.28636 0.9190340 0.27709916
117                        Mexico 11    65.42818 0.9840911 0.29671463
118                    Micronesia 11          NA        NA         NA
119                       Moldova 11    60.16182 2.4102072 0.72670480
120                        Monaco 11          NA        NA         NA
121                      Mongolia 11    53.76273 0.8687471 0.26193711
122                    Montenegro 11    57.97273 1.3771640 0.41523058
123                       Morocco 11    54.90000 3.8637673 1.16496967
124                    Mozambique 11    67.96000 0.4652523 0.14027884
125                       Myanmar 11    58.60727 1.6542974 0.49878945
126                       Namibia 11    67.11727 0.3347861 0.10094180
127                         Nauru 11          NA        NA         NA
128                         Nepal 11    40.56364 1.4586999 0.43981456
129                   Netherlands 11    86.29454 1.3136088 0.39606795
130                   New Zealand 11    85.16546 0.7717184 0.23268184
131                     Nicaragua 11    69.07000 0.9867730 0.29752324
132                         Niger 11    54.12636 3.7763483 1.13861185
133                       Nigeria 11    58.75182 3.2362719 0.97577271
134                          Niue 11          NA        NA         NA
135      Northern Mariana Islands 11          NA        NA         NA
136                        Norway 11    88.08455 1.1030620 0.33258572
137                          Oman 11    39.35182 1.5364886 0.46326875
138                      Pakistan 11    43.99364 0.4158428 0.12538131
139                         Palau 11          NA        NA         NA
140                        Panama 11    76.88000 0.9776402 0.29476961
141              Papua New Guinea 11    70.55818 0.5889457 0.17757380
142                      Paraguay 11    76.66000 0.7504412 0.22626655
143                          Peru 11    72.20636 1.8094268 0.54556271
144                   Philippines 11    70.13727 0.8518938 0.25685563
145                        Poland 11    74.94091 2.1366013 0.64420954
146                      Portugal 11    82.52364 1.3385246 0.40358034
147                   Puerto Rico 11          NA        NA         NA
148                         Qatar 11    25.75182 1.8355591 0.55344190
149   Republic of North Macedonia 11    56.69455 2.3043673 0.69479289
150                       Romania 11    73.36909 1.8476393 0.55708422
151                        Russia 11    78.11909 2.6016941 0.78444029
152                        Rwanda 11    64.70091 0.3859655 0.11637297
153                         Samoa 11          NA        NA         NA
154                    San Marino 11          NA        NA         NA
155         Sao Tome and Principe 11    65.20364 1.1739437 0.35395735
156                  Saudi Arabia 11    32.66182 2.0745354 0.62549595
157                       Senegal 11    65.92818 1.0865528 0.32760801
158                        Serbia 11    63.94909 2.4725744 0.74550922
159                    Seychelles 11    75.61182 0.5796524 0.17477178
160                  Sierra Leone 11    69.22545 0.6181970 0.18639340
161                     Singapore 11    80.79909 0.9323460 0.28111288
162                      Slovakia 11    76.47636 1.9929592 0.60089981
163                      Slovenia 11    84.63727 1.2006668 0.36201466
164               Solomon Islands 11    58.06455 0.1821737 0.05492743
165                       Somalia 11    65.25636 0.2071838 0.06246826
166                  South Africa 11    65.54727 1.7032677 0.51355455
167                   South Sudan 11    63.10455 0.4822309 0.14539808
168                         Spain 11    85.65091 0.8902309 0.26841470
169                     Sri Lanka 11    74.68364 3.6528000 1.10136064
170            St Kitts and Nevis 11          NA        NA         NA
171                      St Lucia 11          NA        NA         NA
172 St Vincent and the Grenadines 11          NA        NA         NA
173                         Sudan 11    41.90000 2.0920473 0.63077599
174                      Suriname 11    66.62273 0.7944203 0.23952672
175                        Sweden 11    92.42636 0.6375013 0.19221386
176                   Switzerland 11    88.78546 1.0134440 0.30556486
177                         Syria 11    43.71455 0.6521862 0.19664154
178                        Taiwan 11    77.42909 1.2461182 0.37571879
179                    Tajikistan 11    41.40727 1.3352013 0.40257835
180                      Tanzania 11    69.47364 0.5272054 0.15895839
181                      Thailand 11    78.32364 1.5420001 0.46493054
182                   Timor-Leste 11    72.00000 0.2694074 0.08122937
183                          Togo 11    65.03182 1.2416990 0.37438632
184                       Tokelau 11          NA        NA         NA
185                         Tonga 11          NA        NA         NA
186           Trinidad and Tobago 11    73.74182 0.9336028 0.28149184
187                       Tunisia 11    54.88818 1.0848764 0.32710254
188                        Turkey 11    52.59545 0.9566651 0.28844539
189                  Turkmenistan 11    57.42818 0.9503032 0.28652720
190                        Tuvalu 11          NA        NA         NA
191                        Uganda 11    64.90273 0.5909505 0.17817828
192                       Ukraine 11    71.12364 1.8448653 0.55624783
193          United Arab Emirates 11    49.36818 7.2746333 2.19338446
194                United Kingdom 11    88.57000 0.9444780 0.28477084
195                 United States 11    84.57455 0.9122520 0.27505433
196                       Uruguay 11    73.00818 1.2026041 0.36259879
197                    Uzbekistan 11    34.23000 1.8336962 0.55288020
198                       Vanuatu 11    65.93455 0.2792624 0.08420079
199                       Vietnam 11    62.98545 2.5073705 0.75600065
200           Virgin Islands (US) 11          NA        NA         NA
201            West Bank and Gaza 11    51.95545 1.0215515 0.30800937
202                         World 11    54.00818 1.0074603 0.30376070
203                         Yemen 11    40.24454 1.6980181 0.51197173
204                        Zambia 11    69.22818 0.3791516 0.11431850
205                      Zimbabwe 11    69.22545 0.4736733 0.14281787
           ci
1   0.6212264
2   0.3811237
3          NA
4          NA
5   0.2730689
6          NA
7   0.4356349
8   1.2651799
9   0.8917982
10  0.8194051
11  0.6684082
12  0.6767498
13  2.0073078
14  0.9716006
15  0.5375292
16  2.0143383
17  0.9613041
18  0.6046459
19  0.8483886
20         NA
21  0.4397870
22  0.6704928
23  1.2601340
24  0.6765084
25  0.9516347
26         NA
27  1.1802758
28  0.8810809
29  0.3334677
30  2.4947758
31  0.6587051
32  1.4223471
33  0.4344360
34  0.7298412
35  1.1327720
36  0.8312224
37  2.2867812
38  1.2723616
39  0.2269173
40  0.4661973
41  0.9202568
42         NA
43  0.5071771
44  0.5620450
45  4.1756966
46  1.2361545
47  1.3405020
48  1.1769098
49  0.7888655
50  1.2230184
51         NA
52  0.3969849
53  1.0956170
54  1.0267849
55  0.6508356
56  1.4041226
57  0.5174360
58  0.7250148
59  0.5994184
60  0.2354273
61  0.2548350
62  0.4445973
63  0.8350791
64  0.2936478
65  0.9618177
66  0.9081274
67  0.6857608
68  1.1682466
69  1.0507329
70         NA
71         NA
72         NA
73  0.7725634
74  0.4635967
75  0.5233600
76  0.8658047
77  0.7238439
78  0.7571428
79         NA
80  1.0558570
81  0.6019386
82  0.4219934
83  0.3876412
84  0.6152134
85  2.4216877
86  0.7429428
87  1.0136372
88  0.8161768
89  0.4023255
90  0.5594466
91  1.1895018
92  1.0557198
93  0.3489307
94         NA
95  0.6353002
96  0.9719970
97         NA
98  1.6370801
99  0.9349368
100 0.7902571
101 1.5868893
102 0.8378909
103 0.6580807
104 0.3885708
105 0.7220577
106 1.2898363
107 1.0185107
108 0.1923723
109 0.4349903
110 0.8551154
111 0.9022337
112 0.5189518
113 1.2444158
114        NA
115 0.9178291
116 0.6174154
117 0.6611214
118        NA
119 1.6191992
120        NA
121 0.5836323
122 0.9251914
123 2.5957142
124 0.3125607
125 1.1113721
126 0.2249123
127        NA
128 0.9799679
129 0.8824944
130 0.5184474
131 0.6629231
132 2.5369853
133 2.1741571
134        NA
135        NA
136 0.7410472
137 1.0322271
138 0.2793670
139        NA
140 0.6567876
141 0.3956591
142 0.5041533
143 1.2155895
144 0.5723100
145 1.4353883
146 0.8992330
147        NA
148 1.2331454
149 1.5480950
150 1.2412610
151 1.7478419
152 0.2592951
153        NA
154        NA
155 0.7886661
156 1.3936918
157 0.7299561
158 1.6610981
159 0.3894158
160 0.4153104
161 0.6263585
162 1.3388882
163 0.8066189
164 0.1223859
165 0.1391880
166 1.1442708
167 0.3239671
168 0.5980652
169 2.4539844
170        NA
171        NA
172        NA
173 1.4054565
174 0.5336988
175 0.4282792
176 0.6808409
177 0.4381447
178 0.8371536
179 0.8970005
180 0.3541814
181 1.0359298
182 0.1809903
183 0.8341847
184        NA
185        NA
186 0.6272029
187 0.7288299
188 0.6426964
189 0.6384224
190        NA
191 0.3970060
192 1.2393974
193 4.8871651
194 0.6345090
195 0.6128592
196 0.8079204
197 1.2318939
198 0.1876111
199 1.6844744
200        NA
201 0.6862876
202 0.6768210
203 1.1407441
204 0.2547175
205 0.3182180
# Looking at average score for each country

SPI %>%
  group_by(`Country`) %>%
  dplyr::summarise(mean = mean(`Environment`))
# A tibble: 205 × 2
   Country              mean
   <chr>               <dbl>
 1 Albania              71.0
 2 Algeria              51.7
 3 American Samoa       NA  
 4 Andorra              NA  
 5 Angola               62.9
 6 Antigua and Barbuda  NA  
 7 Argentina            78.0
 8 Armenia              58.3
 9 Australia            85.1
10 Austria              83.4
# … with 195 more rows

Visualizations

Average scores worldwide by year

By looking at how the world is doing as a whole from 2011-2021, we can get an idea of what the improvement overall has been like and compare that to individual countries’ progress. These graphs have been changed and now show the standard error bars.

# Seeing if average Access to Knowledge scores are changing over time

avgAK <- summarySE(SPI, measurevar="Access-knowledge", groupvars=c("Year"),
                   na.rm=TRUE)

avgAK %>%
ggplot(aes(x=Year, y=`Access-knowledge`)) +
  geom_errorbar(aes(ymin=`Access-knowledge`-se, ymax=`Access-knowledge`+se),
                width=.1, color="blue") +
  geom_line(color="dark blue") +
  geom_point(color="dark blue") +
  labs(y="Avg Access to Knowledge")

# What about Access to Information and Communications?

avgIC <- summarySE(SPI, measurevar="Info-comm", groupvars=c("Year"), na.rm=TRUE)

avgIC %>%
ggplot(aes(x=Year, y=`Info-comm`)) +
  geom_errorbar(aes(ymin=`Info-comm`-se, ymax=`Info-comm`+se), width=.1,
                color="red") +
  geom_line(color="dark red") +
  geom_point(color="dark red") +
  labs(y="Avg Info and Communications")

# Looking at Health and Wellness

avgHW <- summarySE(SPI, measurevar="Health", groupvars=c("Year"), na.rm=TRUE)

avgHW %>%
ggplot(aes(x=Year, y=`Health`)) +
  geom_errorbar(aes(ymin=`Health`-se, ymax=`Health`+se), width=.1,
                color="#b4a7d6") +
  geom_line(color="#4d1c7c") +
  geom_point(color="#4d1c7c") +
  labs(y="Avg Health and Wellness")

# Lastly, looking at Environmental Quality

avgEQ <- summarySE(SPI, measurevar="Environment", groupvars=c("Year"),
                   na.rm=TRUE)

avgEQ %>%
ggplot(aes(x=Year, y=`Environment`)) +
  geom_errorbar(aes(ymin=`Environment`-se, ymax=`Environment`+se), width=.1,
                color="#93c47d") +
  geom_line(color="#274e13") +
  geom_point(color="#274e13") +
  labs(y="Avg Environemtnal Quality")

All of these plots show that there has been improvement across all categories, but not all of them have been consistent and they have all been exponential. Something left out is how each country has improved over the years. I also could have chosen a different metric, such as a median, which can give a different type of insight since means may be skewed due to outliers. Additionally, there aren’t a lot of years included in the dataset compared to the length of human history, so some more historical data could be valuable.

Variation by Country

Since there are a great many countries in the dataset and I don’t want there to be an overcrowded graph, I will select a few countries to look at. I’ll base my selection on the largest countries by population in their respective continent so there is some similarity between them: China, Russia, the United States, Brazil, Nigeria, and Australia.

SPI_Large <- SPI %>%
  filter(`Country` %in% c("China", "Russia", "Brazil", "Nigeria", "Australia",
                          "United States"))

head(SPI_Large)
# A tibble: 6 × 74
   Rank Country   Code   Year Status   SPI Needs Wellbeing Opportunity
  <dbl> <chr>     <chr> <dbl> <chr>  <dbl> <dbl>     <dbl>       <dbl>
1    11 Australia AUS    2021 Ranked  90.3  95.1      90.4        85.3
2    10 Australia AUS    2020 Ranked  90.1  95.1      90.5        84.8
3    12 Australia AUS    2019 Ranked  90    95        90.2        84.8
4    11 Australia AUS    2018 Ranked  89.9  94.6      90.6        84.5
5    10 Australia AUS    2017 Ranked  90.0  95.1      90.2        84.6
6    10 Australia AUS    2016 Ranked  89.8  95.2      89.9        84.5
# … with 65 more variables: `Nutrition/care` <dbl>, Sanitation <dbl>,
#   Shelter <dbl>, Safety <dbl>, `Access-knowledge` <dbl>,
#   `Info-comm` <dbl>, Health <dbl>, Environment <dbl>, Rights <dbl>,
#   Choice <dbl>, Inclusiveness <dbl>, `Advanced-ed` <dbl>,
#   Infectious <dbl>, `Child mortality` <dbl>, Stunting <dbl>,
#   `Maternal-mortality` <dbl>, Undernourishment <dbl>,
#   `Improved-sanitation` <dbl>, `Improved-water` <dbl>, …

By looking at overall rankings over time, there can be a good general idea how these coutries have done in comparison to the others in all indicators, not just a few.

ggplot(data = SPI_Large, mapping=aes(x = `Year`, y = `Rank`, color = `Country`)) +
  geom_line() +
  facet_wrap(facets = vars(`Country`))

(it is important to note that a low rank means the country is doing better than the others and a higher number means it is doing worse)

From the above, we can see that Nigeria has consistently ranked very poorly with very little improvement. Brazil had a slightly better-than-middle ranking, but then was suddenly ranked worse in 2017 and continued to trend poorer every year since. China and Russia, on the other hand, seem pretty stagnant with consistent rankings throughout the years–China doing worse than Russia. Australia has the best consistent rankings out of all the countries, while the US was a close second but has started to be ranked poorly in 2015 or so and on. I think it’s interesting to look at these comparisons when thinking about overall rankings because it makes me wonder what is dragging down or boosting up scores for each country. Something left unanswered is what other countries in the same continent are like for rankings, what caused these rankings to drop, and what categories some countries do better in than others. A general view is helpful but does not tell everything.

Research Questions:

  1. Have the average worldwide scores for Wellbeing categories improved over time? What countries have improved the most or the least?

  2. Do countries that have higher Wellbeing scores have higher scores in other categories? How do the Wellbeing scores relate to rank?

  3. How to large countries from each contient compare?

New Visualizations

# Boxplot of the Large Countries' Wellbeing Scores

SPI_Large %>%
  ggplot(mapping=aes(x=Country, y=Wellbeing, fill=Country)) +
  geom_boxplot() +
  labs(y="Wellbeing Score")

I think so far in my analysis, I am missing more information on whether or not countries’ Wellbeing scores correlate with their Rank (if countries that do better in overall Wellbeing have better Rankings). Right now, I can see that the average worldwide statistics have mostly improved since 2011, though there are some variables that fluctuate a bit more (such as Environmental Quality). Additionally, the larger countries have generally consistent rankings, showing that these worldwide improvements have most likely taken place in other countries. I don’t know if a naive reader would need much else to understand the graphs–if anything, they might need mre information about the Social Progress Index itself and what the variables mean. I would want to answer the question of why certain countries have improved more or less than others in different variables or their overall rankings, but the “why” factor isn’t something present in the dataset.

Reuse

Text and figures are licensed under Creative Commons Attribution CC BY-NC 4.0. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".

Citation

For attribution, please cite this work as

Kimble (2022, May 4). Data Analytics and Computational Social Science: HW 5. Retrieved from https://github.com/DACSS/dacss_course_website/posts/httpsrpubscomkkimble896427/

BibTeX citation

@misc{kimble2022hw,
  author = {Kimble, Karen},
  title = {Data Analytics and Computational Social Science: HW 5},
  url = {https://github.com/DACSS/dacss_course_website/posts/httpsrpubscomkkimble896427/},
  year = {2022}
}