1. Data Load und Transformation

1.1 Data Load

Zuerst werden die Daten hochgeladen und zu den Dataframes umgewandelt. Es werden die Zusammenfassungen ausgefuehrt und werden lesbarere Speltentitel vergeben.

library(knitr)
## Warning: Paket 'knitr' wurde unter R Version 4.2.3 erstellt
library(stringr)
## Warning: Paket 'stringr' wurde unter R Version 4.2.3 erstellt
library(dplyr)
## Warning: Paket 'dplyr' wurde unter R Version 4.2.3 erstellt
## 
## Attache Paket: 'dplyr'
## Die folgenden Objekte sind maskiert von 'package:stats':
## 
##     filter, lag
## Die folgenden Objekte sind maskiert von 'package:base':
## 
##     intersect, setdiff, setequal, union
library(readxl)
## Warning: Paket 'readxl' wurde unter R Version 4.2.3 erstellt
data_2024 <- data.frame(
  read.csv(
    sep = ",", 
    header = T, 
    file = 'C:\\Users\\kasim\\OneDrive\\klsmann\\R\\World-happiness-report-2024.csv'
    )
)
colnames(data_2024) <- c("Country", "Region", "Score", "Score Upper Bound",
                         "Score Lower Bound", "GDP_per_capita", "Social_Support",
                         "Life_Expectancy", "Life_choice", "Generosity",
                         "Corruption", "Dystopia_Score")

# SIE BRAUCHEN HIER NICHTS ANZUPASSEN

url <- 'https://happiness-report.s3.amazonaws.com/2024/DataForTable2.1.xls'
file_name <- "historical_data.xls"
file_path <- getwd()
download.file(url, paste(file_path, file_name, sep = ""), mode = "wb")

hist_data <- data.frame(
  read_excel(
    path = paste(file_path, file_name, sep = "")
    )
)
colnames(hist_data) <- c("Country", "Year", "Score", "GDP_per_capita", 
                   "Social_Support", "Life_Expectancy", "Life_choice",
                   "Generosity", "Corruption", "Positive_affect", 
                   "Negative_affect")

hist_data
data_2024
summary(hist_data)
##    Country               Year          Score       GDP_per_capita  
##  Length:2363        Min.   :2005   Min.   :1.281   Min.   : 5.527  
##  Class :character   1st Qu.:2011   1st Qu.:4.647   1st Qu.: 8.506  
##  Mode  :character   Median :2015   Median :5.449   Median : 9.503  
##                     Mean   :2015   Mean   :5.484   Mean   : 9.400  
##                     3rd Qu.:2019   3rd Qu.:6.324   3rd Qu.:10.393  
##                     Max.   :2023   Max.   :8.019   Max.   :11.676  
##                                                    NA's   :28      
##  Social_Support   Life_Expectancy  Life_choice       Generosity      
##  Min.   :0.2282   Min.   : 6.72   Min.   :0.2283   Min.   :-0.33955  
##  1st Qu.:0.7438   1st Qu.:59.20   1st Qu.:0.6607   1st Qu.:-0.11194  
##  Median :0.8344   Median :65.10   Median :0.7711   Median :-0.02161  
##  Mean   :0.8094   Mean   :63.40   Mean   :0.7503   Mean   : 0.00010  
##  3rd Qu.:0.9038   3rd Qu.:68.55   3rd Qu.:0.8617   3rd Qu.: 0.09357  
##  Max.   :0.9873   Max.   :74.60   Max.   :0.9852   Max.   : 0.69957  
##  NA's   :13       NA's   :63      NA's   :36       NA's   :81        
##    Corruption     Positive_affect  Negative_affect  
##  Min.   :0.0352   Min.   :0.1789   Min.   :0.08274  
##  1st Qu.:0.6868   1st Qu.:0.5720   1st Qu.:0.20856  
##  Median :0.7985   Median :0.6634   Median :0.26217  
##  Mean   :0.7440   Mean   :0.6519   Mean   :0.27316  
##  3rd Qu.:0.8676   3rd Qu.:0.7373   3rd Qu.:0.32621  
##  Max.   :0.9833   Max.   :0.8836   Max.   :0.70459  
##  NA's   :125      NA's   :24       NA's   :16

1.2. Pruefung der Daten

Es wird geprueft, ob die Daten Null-Werte haben. Die Zeilen mit sochen Werten werden entfernt.

Darueber hinaus sind die Werte fuers Jahr 2005 nur fuer Nord America eingegeben. Da wir später den Fokus auf die Zeitreihen liegen, werden diese Werte entfernt.

library(knitr)
library(stringr)
library(dplyr)

print(hist_data[rowSums(is.na(hist_data)) > 0, ])
##                        Country Year    Score GDP_per_capita Social_Support
## 14                 Afghanistan 2022 1.281271             NA      0.2282172
## 15                 Afghanistan 2023 1.445909             NA      0.3684781
## 32                     Algeria 2010 5.463567       9.306355             NA
## 35                     Algeria 2014 6.354898       9.355415      0.8181894
## 36                     Algeria 2016 5.340854       9.383312      0.7485883
## 82                   Australia 2005 7.340688      10.662058      0.9678922
## 134                    Bahrain 2012 5.027187      10.774646      0.9113496
## 135                    Bahrain 2013 6.689711      10.797851      0.8837805
## 136                    Bahrain 2014 6.165134      10.801981             NA
## 137                    Bahrain 2015 6.007375      10.788364      0.8525507
## 138                    Bahrain 2016 6.169673      10.789037      0.8627001
## 139                    Bahrain 2017 6.227321      10.798135      0.8757471
## 140                    Bahrain 2019 7.098012      10.815147      0.8779294
## 141                    Bahrain 2020 6.173176      10.778840      0.8477451
## 142                    Bahrain 2023 5.959068      10.876858      0.8174772
## 151                 Bangladesh 2014 4.635565       8.323469      0.5770651
## 163                    Belarus 2008 5.463332       9.676768      0.9037004
## 175                    Belgium 2005 7.262290      10.743808      0.9348747
## 260                     Brazil 2005 6.636771       9.435151      0.8829229
## 266                     Brazil 2012 6.660004       9.643767      0.8903141
## 314                   Cambodia 2006 3.568745       7.746443      0.7930815
## 315                   Cambodia 2007 4.155971       7.826252      0.6751321
## 326                   Cambodia 2018 5.121838       8.347027      0.7946054
## 351                     Canada 2007 7.481753      10.733993             NA
## 407                      China 2006 4.560495       8.696139      0.7470113
## 408                      China 2007 4.862862       8.823968      0.8108524
## 409                      China 2008 4.846295       8.910974      0.7482873
## 410                      China 2009 4.454361       8.995829      0.7980344
## 411                      China 2010 4.652737       9.092073      0.7677526
## 412                      China 2011 5.037208       9.177827      0.7871712
## 413                      China 2012 5.094917       9.246742      0.7878182
## 414                      China 2013 5.241090       9.314875      0.7778959
## 415                      China 2014 5.195619       9.380201      0.8203660
## 416                      China 2015 5.303878       9.442431      0.7937337
## 417                      China 2016 5.324956       9.502946      0.7417030
## 418                      China 2017 5.099061       9.564058      0.7720332
## 419                      China 2018 5.131434       9.624699      0.7876053
## 420                      China 2019 5.144120       9.678953      0.8219359
## 421                      China 2020 5.771065       9.698712      0.8083345
## 422                      China 2021 5.862864       9.778915      0.8560070
## 423                      China 2023 6.144764       9.860808      0.7969825
## 450        Congo (Brazzaville) 2008 3.819792       8.389738      0.5547719
## 508                       Cuba 2006 5.417869             NA      0.9695951
## 524                     Cyprus 2023 6.070594             NA      0.8028312
## 525                    Czechia 2005 6.439257      10.321686      0.9187595
## 540                    Denmark 2005 8.018934      10.849012      0.9723715
## 560                   Djibouti 2010 5.005811       7.934187             NA
## 598                      Egypt 2005 5.167754       9.041865      0.8478425
## 599                      Egypt 2007 5.540511       9.137560      0.6858633
## 600                      Egypt 2008 4.631741       9.187095      0.7383638
## 609                      Egypt 2017 3.929344       9.305197      0.6382264
## 610                      Egypt 2018 4.005451       9.338146      0.7588241
## 611                      Egypt 2019 4.327832       9.374240      0.7721286
## 612                      Egypt 2020 4.472397       9.391795      0.6727255
## 614                      Egypt 2022 4.023561       9.455696      0.7692161
## 615                      Egypt 2023 3.880640       9.479594      0.7296709
## 655                   Ethiopia 2012 4.561169       7.252151      0.6587943
## 682                     France 2005 7.093393      10.636769      0.9403383
## 736                    Germany 2005 6.619550      10.690792      0.9634904
## 738                    Germany 2008 6.521790      10.771496      0.9232113
## 772                     Greece 2005 6.006310      10.453635      0.8365394
## 847  Hong Kong S.A.R. of China 2006 5.511187      10.746401      0.8121777
## 848  Hong Kong S.A.R. of China 2008 5.137262      10.815522      0.8402224
## 849  Hong Kong S.A.R. of China 2009 5.397056      10.788470      0.8347157
## 850  Hong Kong S.A.R. of China 2010 5.642835      10.846611      0.8573144
## 851  Hong Kong S.A.R. of China 2011 5.474011      10.886909      0.8460602
## 852  Hong Kong S.A.R. of China 2012 5.483765      10.892731      0.8264257
## 853  Hong Kong S.A.R. of China 2014 5.458051      10.939481      0.8335582
## 854  Hong Kong S.A.R. of China 2016 5.498421      10.969893      0.8320779
## 855  Hong Kong S.A.R. of China 2017 5.362475      10.999467      0.8310663
## 856  Hong Kong S.A.R. of China 2019 5.659317      10.995277      0.8558257
## 857  Hong Kong S.A.R. of China 2020 5.295341      10.931178      0.8129430
## 858  Hong Kong S.A.R. of China 2021 5.321551      11.002724      0.8210886
## 859  Hong Kong S.A.R. of China 2022 5.311294      10.976421      0.8030085
## 860                    Hungary 2005 5.193933      10.102768      0.9296283
## 883                    Iceland 2019 7.532505      10.943484      0.9818246
## 888                      India 2006 5.348259       8.141137      0.7073181
## 924                       Iran 2005 5.308190       9.497694      0.7659780
## 928                       Iran 2012 4.608928       9.584786      0.5995426
## 945                       Iraq 2013 4.725017       9.159455      0.7282854
## 972                     Israel 2006 7.173417      10.367561      0.9270789
## 990                      Italy 2005 6.853784      10.697855      0.9280007
## 1029                     Japan 2005 6.515817      10.551915      0.9277120
## 1035                     Japan 2012 5.968216      10.564522      0.9052954
## 1047                    Jordan 2005 6.294660       9.282825      0.9200130
## 1048                    Jordan 2007 5.598057       9.308221      0.8406065
## 1049                    Jordan 2008 4.930058       9.353609      0.7662242
## 1051                    Jordan 2010 5.569942       9.381507      0.9179889
## 1052                    Jordan 2011 5.539328       9.383053      0.8779188
## 1053                    Jordan 2012 5.131996       9.392828      0.8294963
## 1054                    Jordan 2013 5.171953       9.353773      0.8403792
## 1055                    Jordan 2014 5.333022       9.269114      0.8161310
## 1056                    Jordan 2015 5.404593       9.201573      0.8304439
## 1057                    Jordan 2016 5.271285       9.172960      0.8199447
## 1058                    Jordan 2017 4.808083       9.172545      0.8146645
## 1059                    Jordan 2018 4.638934       9.167903      0.7995443
## 1060                    Jordan 2019 4.452548       9.162689      0.7925597
## 1061                    Jordan 2020 4.093992       9.125218      0.7088399
## 1101                    Kosovo 2007 5.103906             NA      0.8478117
## 1102                    Kosovo 2008 5.521660       8.858291      0.8838426
## 1103                    Kosovo 2009 5.891433       8.899382      0.8304265
## 1104                    Kosovo 2010 5.176601       8.939567      0.7079589
## 1105                    Kosovo 2011 4.859502       8.992258      0.7591016
## 1106                    Kosovo 2012 5.639588       9.000282      0.7571471
## 1107                    Kosovo 2013 6.125758       9.046240      0.7207504
## 1108                    Kosovo 2014 5.000375       9.082124      0.7056323
## 1109                    Kosovo 2015 5.077461       9.153252      0.8052708
## 1110                    Kosovo 2016 5.759412       9.213440      0.8238027
## 1111                    Kosovo 2017 6.149200       9.253033      0.7920873
## 1112                    Kosovo 2018 6.391826       9.283142      0.8224065
## 1113                    Kosovo 2019 6.425144       9.334190      0.8425112
## 1114                    Kosovo 2020 6.294414       9.278607      0.7923745
## 1115                    Kosovo 2021 6.648499       9.382963      0.8488386
## 1116                    Kosovo 2022 6.159853       9.431037      0.8876391
## 1117                    Kosovo 2023 6.877793       9.480271      0.8072128
## 1121                    Kuwait 2011 6.377699      11.024464      0.8819120
## 1122                    Kuwait 2012 6.221095      11.011855      0.8889167
## 1123                    Kuwait 2013 6.480031      10.951714      0.8619481
## 1124                    Kuwait 2014 6.180139      10.925643             NA
## 1125                    Kuwait 2015 6.146032      10.893180      0.8230178
## 1126                    Kuwait 2016 5.947195      10.886991      0.8452221
## 1127                    Kuwait 2017 6.093905      10.819924      0.8534913
## 1128                    Kuwait 2019 6.106120      10.764579      0.8415198
## 1129                    Kuwait 2022 6.757829      10.803010      0.8743635
## 1130                    Kuwait 2023 7.130284      10.811560      0.8900112
## 1153                      Laos 2012 4.876085       8.600584      0.6926279
## 1178                   Lebanon 2005 5.491245       9.571391      0.7962784
## 1213                     Libya 2015 5.615405       9.857912      0.8679877
## 1214                     Libya 2016 5.433583       9.828466      0.8760659
## 1219                     Libya 2023 5.970289             NA      0.7481565
## 1251                Madagascar 2006 3.979751       7.351137      0.7111347
## 1295                  Maldives 2018 5.197575       9.892906      0.9133151
## 1313                     Malta 2009 6.327640      10.352514      0.9157721
## 1314                     Malta 2010 5.773875      10.401556      0.9083215
## 1315                     Malta 2011 6.154718      10.401970      0.9226397
## 1316                     Malta 2012 5.962872      10.433339      0.9217520
## 1317                     Malta 2013 6.379925      10.472584      0.9422314
## 1327                     Malta 2023 6.294855             NA      0.9116561
## 1353                    Mexico 2005 6.580658       9.791636      0.9028077
## 1420                   Morocco 2010 4.383247       8.821135             NA
## 1465                     Nepal 2006 4.566595       7.734345      0.8736811
## 1483               Netherlands 2005 7.463979      10.809070      0.9473580
## 1550                     Niger 2023 4.608658       7.181249      0.6379470
## 1596                      Oman 2011 6.852982      10.538620             NA
## 1597                  Pakistan 2005 5.224658       8.252209      0.5909457
## 1667               Philippines 2006 4.669946       8.561695      0.7953133
## 1685                    Poland 2005 5.587209       9.843980      0.9215276
## 1719                     Qatar 2010 6.849653      11.551208             NA
## 1720                     Qatar 2011 6.591604      11.625180      0.8573506
## 1721                     Qatar 2012 6.611299      11.616669      0.8381317
## 1722                     Qatar 2015 6.374529      11.532454             NA
## 1723                   Romania 2005 5.048648       9.732905      0.8376855
## 1758                    Rwanda 2006 4.214704       7.087327      0.7175834
## 1770              Saudi Arabia 2005 7.079644      10.679087      0.8678195
## 1771              Saudi Arabia 2007 7.266694      10.646012      0.8915249
## 1774              Saudi Arabia 2010 6.307098      10.626960      0.8795983
## 1775              Saudi Arabia 2011 6.699790      10.706448      0.8296337
## 1776              Saudi Arabia 2012 6.396359      10.737302      0.8671010
## 1777              Saudi Arabia 2013 6.495133      10.744189      0.8266953
## 1778              Saudi Arabia 2014 6.278378      10.763455      0.8184198
## 1779              Saudi Arabia 2015 6.345492      10.790044      0.8197497
## 1780              Saudi Arabia 2016 6.473921      10.793255      0.8899323
## 1781              Saudi Arabia 2017 6.294282      10.769576      0.8400863
## 1782              Saudi Arabia 2018 6.356393      10.772983      0.8678484
## 1783              Saudi Arabia 2019 6.561247      10.758425      0.9117184
## 1784              Saudi Arabia 2020 6.559588      10.709314      0.8902559
## 1785              Saudi Arabia 2021 6.445294      10.749080      0.8593611
## 1786              Saudi Arabia 2022 6.381610      10.820237      0.9001045
## 1787              Saudi Arabia 2023 6.953374      10.829443      0.8844455
## 1837                 Singapore 2006 6.462703      11.167978      0.9043289
## 1851                 Singapore 2022 6.333046      11.590220      0.8519466
## 1852                 Singapore 2023 6.653942             NA      0.9163257
## 1887         Somaliland region 2009 4.991400             NA      0.8795667
## 1888         Somaliland region 2010 4.657363             NA      0.8290045
## 1889         Somaliland region 2011 4.930572             NA      0.7879617
## 1890         Somaliland region 2012 5.057314             NA      0.7862912
## 1891              South Africa 2006 5.083987       9.455393      0.9130302
## 1915               South Korea 2012 6.003287      10.492640      0.7753974
## 1927               South Sudan 2014 3.831992             NA      0.5451185
## 1928               South Sudan 2015 4.070771             NA      0.5847813
## 1929               South Sudan 2016 2.888112             NA      0.5321518
## 1930               South Sudan 2017 2.816622             NA      0.5568227
## 1931                     Spain 2005 7.152786      10.544352      0.9610429
## 1966        State of Palestine 2006 4.716388       8.201193      0.8179454
## 1967        State of Palestine 2007 4.151054       8.180532      0.7118186
## 1968        State of Palestine 2008 4.385603       8.275286      0.6659107
## 1969        State of Palestine 2009 4.470191       8.336612      0.7380767
## 1970        State of Palestine 2010 4.702604       8.362596      0.8217463
## 1971        State of Palestine 2011 4.751220       8.451591      0.7508323
## 1972        State of Palestine 2012 4.646608       8.598372      0.7821691
## 1973        State of Palestine 2013 4.844028       8.594526      0.7608995
## 1974        State of Palestine 2014 4.721938       8.618412      0.7750867
## 1975        State of Palestine 2015 4.695239       8.683147      0.7661012
## 1976        State of Palestine 2016 4.906618       8.737954      0.8177710
## 1977        State of Palestine 2017 4.628133       8.733621      0.8243451
## 1978        State of Palestine 2018 4.553922       8.717741      0.8194793
## 1979        State of Palestine 2019 4.482537       8.716377      0.8325500
## 1980        State of Palestine 2022 4.907760             NA      0.8596547
## 1981        State of Palestine 2023 4.851185             NA      0.8314445
## 1988                    Sweden 2005 7.376316      10.724154      0.9514699
## 2029  Taiwan Province of China 2011 6.308915      10.693417      0.8625208
## 2030  Taiwan Province of China 2012 6.125917      10.717881      0.8250724
## 2031  Taiwan Province of China 2013 6.340344      10.723532      0.8169929
## 2032  Taiwan Province of China 2014 6.363497      10.749411      0.8700119
## 2033  Taiwan Province of China 2015 6.450088      10.778760      0.8853889
## 2034  Taiwan Province of China 2016 6.512851      10.768047      0.8949893
## 2035  Taiwan Province of China 2017 6.359451      10.774066      0.8911191
## 2036  Taiwan Province of China 2018 6.467005      10.780802      0.8964587
## 2037  Taiwan Province of China 2019 6.537090      10.797460      0.8934306
## 2038  Taiwan Province of China 2020 6.751068             NA      0.9008325
## 2039  Taiwan Province of China 2021 6.246744             NA      0.8662975
## 2040  Taiwan Province of China 2022 6.607147             NA      0.8828195
## 2041  Taiwan Province of China 2023 6.655352             NA      0.8715513
## 2054                Tajikistan 2018 5.497469       8.133034      0.8752435
## 2055                Tajikistan 2019 5.464015       8.181799      0.8798229
## 2056                Tajikistan 2020 5.373399       8.203014      0.7897446
## 2057                Tajikistan 2021 5.286824       8.271411      0.8828889
## 2058                Tajikistan 2022 5.175915       8.327793      0.8651415
## 2059                Tajikistan 2023 5.379471       8.371052      0.8707415
## 2113                   Tunisia 2009 5.025470       9.237955             NA
## 2128              Turkmenistan 2009 6.567713       8.955209      0.9238456
## 2129              Turkmenistan 2011 5.791755       9.146244      0.9644187
## 2130              Turkmenistan 2012 5.463827       9.233412      0.9458413
## 2131              Turkmenistan 2013 5.391763       9.312131      0.8457332
## 2132              Turkmenistan 2014 5.787379       9.391799      0.9089274
## 2133              Turkmenistan 2015 5.791460       9.436702      0.9601585
## 2134              Turkmenistan 2016 5.887052       9.479300      0.9290323
## 2135              Turkmenistan 2017 5.229149       9.525408      0.9084549
## 2136              Turkmenistan 2018 4.620602       9.569492      0.9844890
## 2137              Turkmenistan 2019 5.474300       9.615313      0.9815018
## 2138                   Türkiye 2005 4.718734       9.800281      0.8199364
## 2195      United Arab Emirates 2011 7.118701      10.965007      0.8813689
## 2196      United Arab Emirates 2012 7.217767      11.001253      0.8558768
## 2197      United Arab Emirates 2013 6.620951      11.040596      0.8637158
## 2198      United Arab Emirates 2014 6.539855      11.071845             NA
## 2199      United Arab Emirates 2015 6.568398      11.128389      0.8241367
## 2200      United Arab Emirates 2016 6.830950      11.173874      0.8493798
## 2201      United Arab Emirates 2017 7.039420      11.173000      0.8355274
## 2202      United Arab Emirates 2018 6.603744      11.178160      0.8510413
## 2203      United Arab Emirates 2019 6.710783      11.181391      0.8615333
## 2204      United Arab Emirates 2020 6.458392      11.122373      0.8267556
## 2205      United Arab Emirates 2021 6.733068      11.152440      0.8260606
## 2206      United Arab Emirates 2022 6.737606      11.215853      0.7977371
## 2207      United Arab Emirates 2023 6.728384      11.235544      0.7758082
## 2208            United Kingdom 2005 6.983557      10.661453      0.9788398
## 2226             United States 2006 7.181794      10.920668      0.9645718
## 2227             United States 2007 7.512688      10.931063             NA
## 2263                Uzbekistan 2008 5.311368       8.402388      0.8940259
## 2264                Uzbekistan 2009 5.260721       8.462947      0.9046780
## 2265                Uzbekistan 2010 5.095342       8.507943      0.9032264
## 2271                Uzbekistan 2016 5.892539       8.804467      0.9451022
## 2279                 Venezuela 2005 7.169621       9.316229      0.9552785
## 2293                 Venezuela 2020 4.573830             NA      0.8052242
## 2294                 Venezuela 2021 5.107553             NA      0.8124180
## 2295                 Venezuela 2022 5.948992             NA      0.8993663
## 2296                 Venezuela 2023 5.765363             NA      0.8846679
## 2297                   Vietnam 2006 5.293660       8.553802      0.8876645
## 2298                   Vietnam 2007 5.421688       8.613062      0.8560229
## 2305                   Vietnam 2014 5.084923       8.941402      0.7921685
## 2306                   Vietnam 2015 5.076315       8.998519      0.8486767
## 2308                   Vietnam 2017 5.175279       9.110596             NA
## 2315                     Yemen 2007 4.477133       8.211859      0.8249689
## 2323                     Yemen 2016 3.825631       7.552322      0.7754070
## 2324                     Yemen 2017 3.253560       7.243477      0.7895550
## 2327                     Yemen 2022 3.590379             NA      0.8721133
## 2328                     Yemen 2023 3.531574             NA      0.8249582
##      Life_Expectancy Life_choice    Generosity Corruption Positive_affect
## 14            54.875   0.3683771            NA  0.7331979       0.2058678
## 15            55.200   0.2283012            NA  0.7384709       0.2605132
## 32            65.500   0.5926958 -0.2122973502  0.6180379              NA
## 35            65.900          NA            NA         NA       0.5583592
## 36            66.100          NA            NA         NA       0.5650259
## 82            69.800   0.9349733            NA  0.3904159       0.7697703
## 134           65.480   0.6818229            NA  0.4379153       0.5594158
## 135           65.720   0.8092059            NA  0.5247033       0.7111076
## 136           65.960          NA            NA         NA              NA
## 137           66.200   0.8495212  0.1057531387         NA       0.6533448
## 138           66.125   0.8886911  0.0815555230         NA       0.7362199
## 139           66.050   0.9058585  0.1283646375         NA       0.7543330
## 140           65.900   0.9065355  0.0346589722         NA       0.7113863
## 141           65.825   0.9452326  0.1150526032         NA       0.7295103
## 142           65.600   0.8685609  0.1546350569         NA       0.6705686
## 151           63.280   0.7355129 -0.1148525849  0.7893747              NA
## 163           61.180   0.6399239 -0.2257397622  0.6964960              NA
## 175           68.400   0.9238430            NA  0.5975544       0.6768857
## 260           63.100   0.8821861            NA  0.7449940       0.7699212
## 266           64.220   0.8486063            NA  0.6225432       0.6853108
## 314           57.640          NA  0.2500962317  0.8291811              NA
## 315           57.980   0.8186995  0.1105625853  0.8785076              NA
## 326           61.300   0.9583048  0.0292820204         NA       0.7233442
## 351           70.620   0.9303413  0.2438189834  0.4056084       0.8115772
## 407           65.660          NA            NA         NA       0.6576588
## 408           65.920          NA -0.1816869080         NA       0.6639774
## 409           66.180   0.8530720 -0.0979409963         NA       0.7051333
## 410           66.440   0.7711433 -0.1659753025         NA       0.6696660
## 411           66.700   0.8047936 -0.1388414055         NA       0.6581010
## 412           66.960   0.8241624 -0.1918847263         NA       0.7100548
## 413           67.220   0.8082551 -0.1900650710         NA       0.6891598
## 414           67.480   0.8047239 -0.1630627066         NA       0.7171358
## 415           67.740          NA -0.2219897211         NA       0.7097631
## 416           68.000          NA -0.2496197522         NA       0.6668273
## 417           68.125          NA -0.2327021807         NA       0.6832559
## 418           68.250   0.8776176 -0.1799988002         NA       0.6816652
## 419           68.375   0.8953777 -0.1636862606         NA       0.7215787
## 420           68.500   0.9273562 -0.1781239659         NA       0.7602669
## 421           68.625   0.8911230 -0.1087094173         NA       0.6629610
## 422           68.750   0.8747555  0.0196269769         NA       0.6978098
## 423           69.000   0.7933784 -0.0315709598         NA       0.7079852
## 450           52.240   0.5257468 -0.1253612190         NA       0.6029774
## 508           68.000   0.2814579            NA         NA       0.5961872
## 524           73.200   0.7298096            NA  0.8398324       0.6815127
## 525           67.100   0.8652350            NA  0.9007328       0.6387643
## 540           68.300   0.9711350            NA  0.2365217       0.7766891
## 560           54.600   0.7637303 -0.0722360983  0.5969102              NA
## 598           61.400   0.8173620            NA         NA       0.6887149
## 599           61.520   0.6090769 -0.1262364537         NA       0.5997072
## 600           61.580          NA -0.0926664025  0.9136417       0.6274480
## 609           62.500   0.5925048 -0.1578197181         NA       0.4584104
## 610           62.750   0.6816545 -0.2209923863         NA       0.4066041
## 611           63.000   0.7739511 -0.2044293135         NA       0.4202766
## 612           63.250   0.7695503 -0.1186070219         NA       0.5434517
## 614           63.750   0.7325251 -0.2139369100         NA       0.4856265
## 615           64.000   0.6253408 -0.2102522403         NA       0.4358569
## 655           56.320   0.7763082 -0.0473819897         NA       0.5557349
## 682           70.700   0.8948193            NA  0.6878508       0.6812778
## 736           69.900   0.8466238            NA  0.7810068       0.6847646
## 738           69.960   0.7655570            NA  0.7582662       0.6721312
## 772           69.600   0.7341718            NA  0.8605631       0.5976865
## 847               NA   0.9098201  0.1495340616  0.3559848       0.5911400
## 848               NA   0.9222113  0.2902140021  0.2739451       0.5750729
## 849               NA   0.9180263  0.3015919328  0.2721247       0.6064590
## 850               NA   0.8904177  0.3258913159  0.2557754       0.6005613
## 851               NA   0.8943301  0.2284785658  0.2448866       0.5824913
## 852               NA   0.8797525  0.2163239419  0.3797832       0.5802231
## 853               NA   0.8430824  0.2177071124  0.4229599       0.6024953
## 854               NA   0.7997434  0.0941292867  0.4028126       0.5685545
## 855               NA   0.8306572  0.1339593977  0.4158102       0.5358118
## 856               NA   0.7268522  0.0615925305  0.4319736       0.5193124
## 857               NA   0.7054523 -0.0758842453  0.3803512       0.5216710
## 858               NA   0.6686306  0.0206780825  0.3895895       0.5341476
## 859               NA   0.6969755  0.0401366241  0.3834644       0.5485895
## 860           65.000   0.6968745            NA  0.9028107       0.5782331
## 883           72.000   0.9594701            NA  0.6987079       0.7872226
## 888           55.860   0.7737371            NA  0.8548117       0.5760960
## 924           64.300   0.6511677            NA  0.6364903       0.5146413
## 928           65.280   0.7644184            NA  0.6777071       0.5292985
## 945           60.840          NA -0.0467935875  0.7097262              NA
## 972           71.080   0.8166528            NA  0.9053748       0.6386061
## 990           70.600   0.8021950            NA  0.9439123       0.6061020
## 1029          72.400   0.8677793            NA  0.6989297       0.6859817
## 1035          73.240   0.7528315            NA  0.6923874       0.7084200
## 1047          65.800          NA            NA  0.6697267       0.6298332
## 1048          66.160   0.6460791 -0.1166777760  0.6636448              NA
## 1049          66.340          NA -0.1336466521  0.7094034       0.6557004
## 1051          66.700   0.7880731 -0.0566425547         NA       0.5643734
## 1052          66.880   0.7595645 -0.1551297903         NA       0.5509335
## 1053          67.060   0.6931421 -0.1751288027         NA       0.4692286
## 1054          67.240   0.6922270 -0.1306324154         NA       0.5972898
## 1055          67.420   0.7287432 -0.1130476072         NA       0.6018679
## 1056          67.600   0.7665170 -0.0509371310         NA       0.6166210
## 1057          67.600   0.7713506 -0.0420126282         NA       0.5977168
## 1058          67.600   0.7662625 -0.1560838670         NA       0.5544319
## 1059          67.600   0.7624203 -0.1894188821         NA              NA
## 1060          67.600   0.7257558 -0.1675848067         NA              NA
## 1061          67.600   0.7785335 -0.1535932720         NA              NA
## 1101              NA   0.3813638            NA  0.8944622       0.6137231
## 1102              NA          NA  0.0937598795  0.8490592       0.4996457
## 1103              NA   0.5064151  0.2028018534  0.9678386       0.5275571
## 1104              NA   0.4514438  0.1708641648  0.9672717       0.6729829
## 1105              NA   0.5889788  0.0035335927  0.9192120       0.6037397
## 1106              NA   0.6357934  0.0277799834  0.9496514       0.5618538
## 1107              NA   0.5684631  0.1141884625  0.9350946       0.6499571
## 1108              NA   0.4413912  0.0098844087  0.7752006       0.5517187
## 1109              NA   0.5610483  0.1773806661  0.8506471       0.6845785
## 1110              NA   0.8273986  0.1203578040  0.9408979       0.5884126
## 1111              NA   0.8576767  0.1122422740  0.9251918       0.6169122
## 1112              NA   0.8897370  0.2641344666  0.9220782       0.6422236
## 1113              NA   0.8411896  0.2416997701  0.9202973       0.6116000
## 1114              NA   0.8798376  0.3018060029  0.9098939       0.5926777
## 1115              NA   0.8401166  0.2581380904  0.8423788       0.5782843
## 1116              NA   0.8648659  0.2075678110  0.8459503       0.5492900
## 1117              NA   0.8996810  0.2851782441  0.8109320       0.6821652
## 1121          69.400   0.7686035            NA  0.5604239       0.7262067
## 1122          69.600   0.9340495            NA         NA       0.7941445
## 1123          69.800   0.7505249            NA         NA       0.6862512
## 1124          70.000          NA            NA         NA              NA
## 1125          70.200   0.8216624  0.0768639371         NA       0.6782535
## 1126          70.175   0.8409672 -0.0796072334         NA       0.6427400
## 1127          70.150   0.8841816 -0.0095338998         NA       0.6486676
## 1128          70.100   0.8672738 -0.1064813957         NA       0.6432221
## 1129          70.025   0.9685803  0.1415481716         NA       0.7375181
## 1130          70.000   0.8975395  0.1360409409         NA       0.7294351
## 1153          58.160          NA  0.2274431586         NA       0.7405874
## 1178          65.100   0.7032058            NA  0.9451770       0.5581349
## 1213          64.300   0.7745450 -0.0891469643         NA       0.6516380
## 1214          64.525   0.8223848 -0.1352302432         NA       0.6449336
## 1219          66.100   0.7622229            NA  0.6437333       0.5848360
## 1251          54.140          NA -0.0418548137         NA       0.5625942
## 1295          69.775   0.8547593  0.0134495087         NA              NA
## 1313          70.220   0.8031798  0.4561842084         NA       0.6256802
## 1314          70.400   0.8020444  0.2779935896         NA       0.6237110
## 1315          70.580   0.8819218  0.2876778543         NA       0.6378338
## 1316          70.760   0.8606899  0.3430950940         NA       0.6386947
## 1317          70.940   0.9094363  0.4004743397         NA       0.6290109
## 1327          71.700   0.8508147            NA  0.7800309       0.6438156
## 1353          64.400   0.8137455            NA  0.7642490       0.7632874
## 1420          62.500   0.6629004 -0.1731679887  0.9004531              NA
## 1465          59.660   0.6892958            NA  0.8971366       0.5825397
## 1483          70.700   0.9010078            NA  0.5713422       0.7007394
## 1550          56.900   0.7669633  0.0290120486         NA       0.7472665
## 1596          62.340   0.9162930  0.0077922372         NA              NA
## 1597          53.200   0.6299959            NA  0.8444362              NA
## 1667          61.360   0.8282731  0.0580505505  0.8412988       0.7559792
## 1685          66.200   0.7824731            NA  0.9829309       0.6106260
## 1719          64.700          NA  0.0951643065         NA              NA
## 1720          65.040   0.9046875  0.0002451812         NA       0.6607173
## 1721          65.380   0.9243336  0.1485478580         NA       0.6826998
## 1722          66.400          NA            NA         NA              NA
## 1723          64.500   0.8001206            NA  0.9568846       0.5763481
## 1758          53.500   0.9154809            NA  0.2986435       0.7007267
## 1770          61.200          NA            NA  0.5051491       0.6806912
## 1771          61.600   0.6220702  0.0016602428         NA       0.7182027
## 1774          62.200   0.6777772 -0.0339324400         NA       0.6453192
## 1775          62.400   0.6034557 -0.1442522556         NA       0.6989942
## 1776          62.600   0.5604554 -0.1225293279         NA       0.6916764
## 1777          62.800   0.6610423 -0.0848622024         NA       0.6911656
## 1778          63.000   0.7622517 -0.0771780759         NA       0.6633314
## 1779          63.200   0.8202072 -0.0502851307         NA       0.6676526
## 1780          63.400   0.7742677 -0.1384591758         NA       0.7249463
## 1781          63.600   0.8141422 -0.1375489831         NA       0.7027248
## 1782          63.800   0.8549215 -0.1984841973         NA       0.6955330
## 1783          64.000   0.8910866 -0.1529764831         NA       0.6735583
## 1784          64.200   0.8842201 -0.1171723530         NA       0.7018788
## 1785          64.400   0.9024730 -0.1077564582         NA       0.7284732
## 1786          64.600          NA -0.0318562090         NA       0.6774592
## 1787          64.800          NA  0.0275029205         NA       0.7368979
## 1837          71.580   0.7568735  0.1320583969         NA       0.6889830
## 1851          73.900   0.8732907  0.0884381384         NA       0.6875272
## 1852          74.000   0.8612334            NA  0.1525431       0.6671569
## 1887              NA   0.7463040            NA  0.5133718       0.7078735
## 1888              NA   0.8201819            NA  0.4710945       0.6319473
## 1889              NA   0.8581045            NA  0.3573409       0.6905138
## 1890              NA   0.7582190            NA  0.3338317       0.6867316
## 1891          46.000   0.6487629 -0.0943574458         NA       0.7242324
## 1915          71.340   0.6183981            NA  0.8437194       0.6101918
## 1927          52.880   0.5672593            NA  0.7415406       0.5784099
## 1928          53.000   0.5116310            NA  0.7096059       0.5527263
## 1929          53.175   0.4399190            NA  0.7853178       0.5937412
## 1930          53.350   0.4560111            NA  0.7612696       0.5649993
## 1931          70.400   0.9161647            NA  0.7772723       0.6943226
## 1966              NA   0.5465065            NA  0.8578240       0.4915361
## 1967              NA   0.3652962 -0.0828360319  0.8441804       0.5152423
## 1968              NA   0.3577565 -0.0751813427  0.7532130       0.5129869
## 1969              NA   0.4678119 -0.0912122652  0.7973542       0.4737675
## 1970              NA   0.5042623 -0.1210874915  0.7524146       0.5525128
## 1971              NA   0.5218893 -0.1307514161  0.7502076       0.4990743
## 1972              NA   0.5415829 -0.1634781808  0.7301941       0.5597333
## 1973              NA   0.4539034 -0.1630517840  0.7796457       0.5367390
## 1974              NA   0.6570498 -0.1634815931  0.8041654       0.5046321
## 1975              NA   0.5560409 -0.1727104783  0.7743014       0.5364472
## 1976              NA   0.6076694 -0.1514524817  0.8124647       0.5437761
## 1977              NA   0.6316113 -0.1857153922  0.8306463       0.5339183
## 1978              NA   0.6545345 -0.1627649814  0.8137795       0.5283923
## 1979              NA   0.6534883 -0.1352318972  0.8292828       0.5380728
## 1980              NA   0.6948527            NA  0.8357949       0.5841109
## 1981              NA   0.7077621            NA  0.8081274       0.5796463
## 1988          71.000   0.9643954            NA         NA       0.7424797
## 2029              NA   0.7614882  0.0300891139  0.7545843       0.7271060
## 2030              NA   0.6981952  0.0155783305  0.8028291       0.7016373
## 2031              NA   0.6900709 -0.0026161312  0.8412319       0.7544782
## 2032              NA   0.6928998  0.0894067436  0.8657406       0.7673701
## 2033              NA   0.7008105  0.0171499066  0.8571948       0.7503577
## 2034              NA   0.7189252 -0.0486447290  0.8105210       0.7426800
## 2035              NA   0.7596548 -0.0696192235  0.7427801       0.7153032
## 2036              NA   0.7410328 -0.1786981821  0.7359707       0.7459192
## 2037              NA   0.8144845 -0.1306994408  0.7181123       0.7620972
## 2038              NA   0.7988347            NA  0.7105674       0.7431689
## 2039              NA   0.8184674            NA  0.6754386       0.6674166
## 2040              NA   0.8001916            NA  0.6575559       0.7165869
## 2041              NA   0.7945076            NA  0.6406391       0.7476870
## 2054          61.850          NA -0.0737134591  0.5779459       0.6317391
## 2055          62.000          NA -0.0538209006  0.4900294       0.6630628
## 2056          62.150          NA -0.0544736944  0.5497864       0.6518939
## 2057          62.300          NA -0.0712976158  0.4989247       0.6550133
## 2058          62.450          NA -0.0027092518  0.3968735       0.7101930
## 2059          62.600          NA -0.0543776788  0.4823854       0.6379448
## 2113          66.220   0.7814963 -0.1270304620  0.7222106              NA
## 2128          59.780          NA -0.1047438234         NA       0.6953082
## 2129          60.420          NA  0.0153852534         NA       0.5766156
## 2130          60.740   0.7855633 -0.1258418262         NA       0.5407994
## 2131          61.060   0.7045295 -0.0745103732         NA       0.5519428
## 2132          61.380   0.8046781  0.0288778692         NA       0.6138071
## 2133          61.700   0.7013584  0.0896777436         NA       0.6333180
## 2134          61.800   0.7485044  0.0015324412         NA       0.5596974
## 2135          61.900   0.7203992  0.0629473329         NA       0.4879651
## 2136          62.000   0.8577741  0.2565519810         NA       0.5671755
## 2137          62.100   0.8915269  0.2817543745         NA       0.4938911
## 2138          66.100   0.6231149            NA  0.8769986       0.4786797
## 2195          65.160   0.8894635  0.0630679503         NA       0.7015543
## 2196          65.220   0.9197926            NA         NA       0.7194701
## 2197          65.280   0.9359788            NA         NA              NA
## 2198          65.340          NA            NA         NA              NA
## 2199          65.400   0.9150362  0.1918977201         NA       0.7220892
## 2200          65.550   0.9491195  0.1199858785         NA       0.7390807
## 2201          65.700   0.9620166  0.2055502832         NA       0.7373489
## 2202          65.850   0.9436644  0.0430807695         NA       0.7228231
## 2203          66.000   0.9114195  0.1177626327         NA       0.7300516
## 2204          66.150   0.9421615  0.0489101894         NA       0.7023953
## 2205          66.300   0.9513279  0.1496680826         NA       0.6966700
## 2206          66.450   0.9322957  0.1682716906         NA       0.7151054
## 2207          66.600   0.8859221  0.1552173048         NA       0.6546959
## 2208          69.100   0.9223545            NA  0.3984569       0.7794677
## 2226          66.780   0.9114961            NA  0.6003087       0.7748327
## 2227          66.760   0.8719038  0.1911349148  0.6330351       0.7559153
## 2263          61.820   0.8312688 -0.0329061784         NA       0.6470930
## 2264          62.060          NA  0.0033027593  0.6102578       0.6460403
## 2265          62.300          NA -0.0399318412  0.5187202       0.6648530
## 2271          63.800   0.9838030  0.1992702335         NA       0.7712575
## 2279          65.500   0.8381980            NA  0.7198001       0.8029288
## 2293          64.225   0.6118146            NA  0.8113191       0.6893495
## 2294          64.050   0.5956204            NA  0.8238984       0.6975868
## 2295          63.875   0.7704167            NA  0.7980164       0.7543370
## 2296          63.700   0.7565302            NA  0.8253929       0.7576852
## 2297          64.180   0.8857921 -0.0064039212         NA       0.6574848
## 2298          64.260   0.9178360  0.0682206154  0.7539340              NA
## 2305          64.820          NA -0.0215417631         NA       0.6338523
## 2306          64.900          NA  0.0637003407         NA       0.5831194
## 2308          65.100          NA            NA         NA              NA
## 2315          58.720   0.6726853  0.0059116581         NA       0.5236518
## 2323          58.175   0.5329641 -0.1442545950         NA       0.4010074
## 2324          57.950   0.5951908 -0.1277617216         NA       0.3681063
## 2327          56.825   0.6067880            NA  0.7875547       0.4599517
## 2328          56.600   0.5827243            NA  0.7714635       0.4465342
##      Negative_affect
## 14        0.57551187
## 15        0.46016687
## 32                NA
## 35        0.17686610
## 36        0.37711197
## 82        0.23801209
## 134       0.38081476
## 135       0.30620942
## 136               NA
## 137       0.30297211
## 138       0.28346634
## 139       0.28975952
## 140       0.31710640
## 141       0.29683545
## 142       0.33594000
## 151       0.23067836
## 163       0.24565929
## 175       0.26037994
## 260       0.30177984
## 266       0.34975868
## 314       0.34102330
## 315       0.32033542
## 326       0.41434580
## 351       0.25681007
## 407       0.16958039
## 408       0.15861352
## 409       0.14696305
## 410       0.16165024
## 411       0.15809965
## 412       0.13350345
## 413       0.15870300
## 414       0.14221105
## 415       0.11151771
## 416       0.17131498
## 417       0.14562516
## 418       0.21400476
## 419       0.18963979
## 420       0.14651184
## 421       0.24491823
## 422       0.23961844
## 423       0.21035005
## 450       0.29778984
## 508       0.27660152
## 524       0.29686353
## 525       0.25794896
## 540       0.15367195
## 560               NA
## 598       0.34555519
## 599       0.35534760
## 600       0.30101779
## 609       0.41449380
## 610       0.28518379
## 611       0.31276339
## 612       0.44203359
## 614       0.30701083
## 615       0.35232994
## 655       0.13716613
## 682       0.22509420
## 736       0.19726248
## 738       0.22000039
## 772       0.26364303
## 847       0.23595542
## 848       0.23663445
## 849       0.21010421
## 850       0.18310565
## 851       0.19571157
## 852       0.18334927
## 853       0.24286754
## 854       0.21311459
## 855       0.20059341
## 856       0.35760728
## 857       0.21031362
## 858       0.22356504
## 859       0.20371984
## 860       0.29032695
## 883       0.17770353
## 888       0.19860162
## 924       0.45610940
## 928       0.52496874
## 945       0.55427873
## 972       0.30849561
## 990       0.29469815
## 1029      0.15315105
## 1035      0.17147471
## 1047      0.23955956
## 1048      0.23974997
## 1049      0.33120117
## 1051      0.34341875
## 1052      0.26032415
## 1053      0.34533641
## 1054      0.28603330
## 1055      0.31264609
## 1056      0.30519578
## 1057      0.31191337
## 1058      0.39150518
## 1059              NA
## 1060              NA
## 1061              NA
## 1101      0.23669948
## 1102      0.31782779
## 1103      0.16882975
## 1104      0.11771742
## 1105      0.12443766
## 1106      0.09963039
## 1107      0.20273124
## 1108      0.20595025
## 1109      0.17998882
## 1110      0.14960672
## 1111      0.18587910
## 1112      0.17024846
## 1113      0.14079235
## 1114      0.20145804
## 1115      0.11607832
## 1116      0.14242034
## 1117      0.13978057
## 1121      0.17682514
## 1122      0.09549049
## 1123      0.28262898
## 1124              NA
## 1125      0.32369143
## 1126      0.31492299
## 1127      0.30732080
## 1128      0.30287632
## 1129      0.15638791
## 1130      0.20697770
## 1153      0.38667923
## 1178      0.29214981
## 1213      0.36890522
## 1214      0.38307375
## 1219      0.37207776
## 1251      0.16133344
## 1295              NA
## 1313      0.35787433
## 1314      0.37530267
## 1315      0.33970287
## 1316      0.39050397
## 1317      0.36955813
## 1327      0.36133561
## 1353      0.21894287
## 1420              NA
## 1465      0.17083821
## 1483      0.23279472
## 1550      0.41663733
## 1596      0.29516411
## 1597      0.23726571
## 1667              NA
## 1685      0.28243923
## 1719              NA
## 1720      0.32778990
## 1721      0.32218143
## 1722              NA
## 1723      0.34568691
## 1758      0.18899633
## 1770      0.24255303
## 1771      0.23154743
## 1774      0.29720894
## 1775      0.24013972
## 1776      0.22484098
## 1777      0.27555007
## 1778      0.31294948
## 1779      0.32713938
## 1780      0.26629266
## 1781      0.30584189
## 1782      0.28837991
## 1783      0.23773733
## 1784      0.25119907
## 1785      0.22837028
## 1786      0.20495586
## 1787      0.23986267
## 1837      0.26672077
## 1851      0.20898351
## 1852      0.19048551
## 1887      0.11201218
## 1888      0.08342576
## 1889      0.12224420
## 1890      0.15242822
## 1891      0.22273134
## 1915      0.20636466
## 1927      0.42831966
## 1928      0.44979510
## 1929      0.54925692
## 1930      0.51736379
## 1931      0.24064258
## 1966      0.43057960
## 1967      0.41232789
## 1968      0.40328255
## 1969      0.46642825
## 1970      0.38149005
## 1971      0.38765123
## 1972      0.37850383
## 1973      0.36527574
## 1974      0.38045242
## 1975      0.36908489
## 1976      0.37764180
## 1977      0.41607204
## 1978      0.41892853
## 1979      0.39967230
## 1980      0.36177573
## 1981      0.37829217
## 1988      0.15076610
## 2029      0.11228809
## 2030      0.14001080
## 2031      0.12444483
## 2032      0.10836614
## 2033      0.12934870
## 2034      0.10830542
## 2035      0.11412316
## 2036      0.09269565
## 2037      0.09341238
## 2038      0.08273695
## 2039      0.12297951
## 2040      0.09539852
## 2041      0.11053529
## 2054      0.21979381
## 2055      0.17849720
## 2056      0.34416127
## 2057      0.24020000
## 2058      0.21988563
## 2059      0.23134641
## 2113              NA
## 2128      0.15158361
## 2129      0.12206800
## 2130      0.11688070
## 2131      0.15960616
## 2132      0.15394974
## 2133      0.30103889
## 2134      0.25549924
## 2135      0.34962767
## 2136      0.18902454
## 2137      0.18334325
## 2138              NA
## 2195      0.21587004
## 2196      0.22398534
## 2197      0.29111284
## 2198              NA
## 2199      0.29573298
## 2200      0.24466790
## 2201      0.20759845
## 2202      0.30204183
## 2203      0.28376329
## 2204      0.29848030
## 2205      0.21710992
## 2206      0.24153912
## 2207      0.30435458
## 2208      0.26173222
## 2226      0.26051095
## 2227      0.23167929
## 2263      0.18668240
## 2264      0.15865655
## 2265      0.15188271
## 2271      0.14689766
## 2279      0.23301369
## 2293      0.39625046
## 2294      0.38935080
## 2295      0.29225200
## 2296      0.30003795
## 2297      0.20397918
## 2298      0.20593211
## 2305      0.24060678
## 2306      0.23241614
## 2308              NA
## 2315      0.37878445
## 2323      0.22792453
## 2324      0.29506359
## 2327      0.25515127
## 2328      0.34079355
hist_data <- na.omit(hist_data)
hist_data <- hist_data[!(hist_data$Year %in% 2005), ]

1.3 Kategorisierung

Anhand von Quantilen werden folgende Kategorien für Glueckheitsrate vergeben: bis 4.70: niedrig 4.7 - 5.5: mittel 5.5 - 6.4: hoch ab 6.4: sehr hoch

library(knitr)
library(dplyr)
break_points <- c(0, 4.70, 5.5, 6.4, Inf)

# as.character fuer die Kontigenztabelle spaeter
hist_data <- hist_data %>%
  mutate(Сategory = as.character(
    cut(Score,
        breaks = break_points,
        labels = c("Niedrig", "Mittel", "Hoch", "Sehr hoch"),
        include.lowest = TRUE)
    )
  )

hist_data
hist_data[hist_data$Region %in% "Commonwealth of Independent States", ]
hist_data <- 
  df_merged <- 
  merge(
    hist_data, 
    data_2024[, c('Country', 'Region')], by = 'Country', all.x = FALSE
    )

hist_data <-  hist_data[, 
          c("Country", "Region", "Year", "Score", "Сategory", "GDP_per_capita",
            "Social_Support", "Life_Expectancy", "Life_choice", "Generosity",
            "Corruption", "Positive_affect", "Negative_affect")]


hist_data[, c("Country", "Region", "Year", "Score", "Сategory")] |> 
  arrange(Country, Year)

1.4 Median oder Durchschnitt?

Anhand der Histogram laesst sich behaupten, dass die Werte linkssteil sind. Aus diesem Grund macht es mehr Sinn, median statt Durchschnitt im weiteres zu benutzen.

library(lattice)
## Warning: Paket 'lattice' wurde unter R Version 4.2.3 erstellt
histogram(
   hist_data$Score, 
   xlab = "Score", 
   ylab = "% der Gesamtheit"
)

1.5 Sind die regionen wichtig?

Die Frage laesst sich leicht beantworten, indem man die Determinationskoeffizient ausrechnet. Die Regionzugehoerigkeit soll ca. 63 % der Variation von Score.

Eine weitere Frage besteht darin, ob die Daten zu den Regionen vollstaendig sind.

library(ggplot2)
## Warning: Paket 'ggplot2' wurde unter R Version 4.2.3 erstellt
library(dplyr)

model_regions <- lm(hist_data$Score ~ hist_data$Region)
summary(model_regions)$r.squared
## [1] 0.6362276
reg_year_distribution <- 
  hist_data %>%
    count(Region, Year, name = "Count")
reg_year_distribution_bv <- 
  reg_year_distribution %>%
  group_by(Region) %>%
  summarize(max_count = max(Count), min_count = min(Count))

reg_year_distribution
reg_year_distribution_bv
ggplot(reg_year_distribution, aes(x = Year, y = Count, color = Region)) +
  geom_line()

Die Vollstaebdigkeit der Daten veriiert sich ueber die Periode.

2 Allgemeine Ansicht

Diese Frage lasst sich beantworten, indem man das Median ausrechnet und zusaetalich die regionalen Medianen betrachtet. Allgemein ist die Gluecksrate zwischen den Jahren 2006 und 2023 um 15% gestiegen. Es lassen sich aber samtliche regionalen Unterschiede erkennen, die wir spaeter unter die Lupe nehmen. *

library(knitr)
library(ggplot2)
library(dplyr)

hist_data_aggr <- 
  hist_data %>%
    group_by(Region, Year) %>%
    summarise(mean_score = median(Score), mean_score_lag = mean_score / first(mean_score) * 100)
## `summarise()` has grouped output by 'Region'. You can override using the
## `.groups` argument.
hist_data_aggr
median_data <- 
  hist_data %>%
    group_by(Year) %>%
    summarise(mean_score = median(Score))
median_data
median_data[median_data$Year %in% 2023, 2] / median_data[median_data$Year %in% 2006, 2] * 100
ggplot(hist_data_aggr, 
       aes(x = Year, y = mean_score, color = Region)) +
  geom_line() +
  geom_line(
    data = median_data, 
    aes(x = Year, y = mean_score, color = "Median"), 
    linetype = "dashed", 
    col = "red") +
  labs(title = "Mean Happiness Score by regions & years",
       x = "Years",
       y = "Mean Happiness Score") +
  theme_minimal()

Wie veraendert sich die Rate im Laufe der Zeit? Lässt sich behaupten, dass von ca. 2010 bis 2020 die Rate tendenziell aufstieg? Zuerst schauen wir die tendenzen des gesamten Datasets.

library(tidyr)
## Warning: Paket 'tidyr' wurde unter R Version 4.2.3 erstellt
# da steht fuer Differenz Absolut 
median_data_da <- median_data %>%
  arrange(Year) %>%
  mutate(change = mean_score - lag(mean_score))
median_data_da
barplot(
  height = median_data_da$change, 
  names = median_data_da$Year, 
  ylim=c(-0.4, 0.4), 
  xlab="Years", 
  ylab="Mean Score", 
  main="Absolute Änderung von Mean Score zum Vohrjahr", 
  )

# dp steht fuer Differenz Relativ 
mean_data_dr <- median_data %>%
  mutate(change = mean_score / first(mean_score) * 100)
mean_data_dr
plot(mean_data_dr$Year, mean_data_dr$change, type = "l",
  xlab="Years", 
  ylab="Mean Score", 
  main="Relative Änderung von Mean Score zum Vohrjahr"
  ) + abline(v = c(2008, 2011, 2020, 2022), col = "red")

## integer(0)

Darueber hinaus erscheit es sinnvoll, einzelne Regionen in Betracht zu ziehen. Aufgrung der Unvollstandigkeit der Daten werden nur die Periode ab 2011 betrachtet. Dabei ist ein wichtiger Hinweis in Betracht zu ziehen: Die starke Fluktuation der Rate in Ostasien in den Jahren 2012-2013 ist auf die unvollstaendigkeit der Daten zurueckzufuehren.

library(tidyr)
# ap steht fuer Aggregated and Pivoted 
hist_data_ap <- hist_data_aggr %>%
  pivot_wider(names_from = Year, values_from = mean_score)

hist_data_aggr |> 
  arrange(Year)
hist_data_aggr
# da steht fuer Differenz Absolut
for (region in unique(hist_data_aggr$Region)) {
  hist_data_ap_da <- hist_data_aggr[hist_data_aggr$Year %in% c(2013:2023), ] %>%
    arrange(Region, Year) %>%
    group_by(Region) %>% 
    filter(Region == region) %>%
    mutate(change = mean_score - lag(mean_score))
  
barplot(
  height = hist_data_ap_da$change, 
  names = hist_data_ap_da$Year, 
  xlab ="Years", 
  ylab ="Mean Score", 
  main = paste("Absolute Änderung von Mean Score zum Vohrjahr in ", region), 
  cex.main = 1, 
  ylim = c(-0.6, 0.6)
  )
}

hist_data_ap_da <- hist_data_ap_da[, c(1, 2, 4)]
hist_data_ap_da

Darueber hinaus kann man das Verhaeltnis ueber die betrachtete Periode zum Jahr 2006 zuehen. Das laesst einen den ENtschuss ziehen, ob die obigen absoluten Aenderungen i.d.R. so graviederend waren.

for (region in unique(hist_data_aggr$Region)) {
hist_data_aggr_dr <- hist_data_aggr[hist_data_aggr$Year %in% c(2013:2023), ] %>%
  arrange(Region, Year) %>%
  mutate(change = mean_score / first(mean_score) * 100) %>%
  filter(Region == region)
hist_data_aggr_dr

plot(hist_data_aggr_dr$Year, hist_data_aggr_dr$change, type = "l",
  xlab="Years", 
  ylab="Mean Score", 
  main= paste("Mean Score relativ zum Jahr 2003 in", region)
  )
}

2.1 Fazit

Aus den obigen Betrachtungen lassen sich folgende Schussfolgerungen ziehen: * Die Gluecksrate ist in den letzten ca. 15 Jahren Fluktuationen untergegangen * Nur einige Regionen, naemlich Zentral- und Osteuropa, ehemalige UdSSR und Suedostasian zeigen positive Dynamik. * Nordafrica und Haher Osten haben den gravierenden Untergang der Gluecksrate erlebt.

3 Vertelimg der Kategorien

3.1 Absolute Verteilung im Jahr 2023

Am Anfang haben wir die Daten in verschiedenen Kategorien anhand der Rate zerlegt. Wie werden die Kategorien bei den Regionen im Jahr 2023 verteilt? Anhand der Grafiken lassen sich die regionalen Verteilungen erkennen. Es herrscht also eine gewisse Ungleichheit zwischen den Regionen.

library(ggplot2)
library(tidyr)

hist_data_2023 <- hist_data[hist_data$Year %in% 2023, ]
host_data_cont <- table(hist_data_2023$Region, hist_data_2023$Сategory)

host_data_cont_df <- as.data.frame(host_data_cont)
colnames(host_data_cont_df) <- c("Region", "Category", "Frequency")
host_data_cont_df
host_data_cont <- rbind(
  host_data_cont, 
  colSums(host_data_cont)
)
host_data_cont <- cbind(
  host_data_cont, 
  rowSums(host_data_cont)
)

colnames(host_data_cont)[colnames(host_data_cont) == ''] <- "Total"
rownames(host_data_cont)[rownames(host_data_cont) == ''] <- "Total"
host_data_cont <- as.data.frame(host_data_cont)
host_data_cont
hist_data_contr <- round(host_data_cont / host_data_cont[11, 5], 4) * 100
hist_data_contr
ggplot(host_data_cont_df, aes( fill=Category, y=Region, x=Frequency)) + 
  geom_bar(position="stack", stat="identity")

3.2 Verteilung und Ungleichheit innerhalb der Regionen

Wie werden die Daten innerhalb der Regionen verteilt? Anhand der Boxplots und Tabelle fuer den Gini Koeffizient laesst sich behaupten, dass die regionalen Unterschiede unterschiedlich anfallen. Da der Gini Koeffizient groesser als alle “regional berechnete” Gini Koeffizienten sind, ist es zu behaupten, dass es eine gewisse Ungleichheit zwischen Regionen herrscht. Das gleiche gilt fuer Standardabweichung.

library(ineq)

hist_data_2023 <- hist_data[hist_data$Year %in% 2023, ]

for (region in unique(hist_data_2023$Region)) {
  hist_data_region_sample <- hist_data[hist_data$Region == region, ]
  boxplot(hist_data_region_sample$Score, main = paste("Boxplot fuer ", region))
}

hist_data_2023_sd <- 
  hist_data_2023 %>%
    group_by(Region) %>%
    summarize(gini = Gini(Score), sd = sd(Score)) %>%
    arrange(gini)

Gini(hist_data_2023$Score)
## [1] 0.1102669
sd(hist_data_2023$Score)
## [1] 1.093783
hist_data_2023_sd

3.3 Fazit

Die Gluecksrate sollte ungleich verteilt sein, wobei es wie oben erklart einen samtlichen Zusammenhang zwischen der regionalen Zugehoerigkeit und der Gluecksrate gibt.

4. Abhängigkeiten

Die Werte veraendern sich aber im Laufe der Zeit maßgeblich. Soll man bepeispielsweise das Berufsleben betrachten, erlebt die Ansicht daran einen großen Wandel, da die Work-LifeäBalance eine immer großer werdende Rolle spielt. Unser Ziel in diesem Abschnitt besteht darin, die Trends zu erkennen.

4.1 Korrelation zwischen Gluecksrate und Variablen

Als erstes schauen wir, inwiefern die einzelne unabhängige Variable und die abhaengige Variabel miteinander in Verbindung stehen. Es laesst sich behaupten, dass GDP per Capita, Social Support und Life Expectancy den groeßten Einfluß auf die Gluecksrate ausüben, gefolgt von Life Choice and Positive Effect. Waehrend Generosity scheint einen sehr beschraenkten Einfluß zu haben, haben Negative Affekt und Perception of Corruption einen ungekehrten Effekt.

library(knitr)
library(ggplot2)
library(pheatmap)
## Warning: Paket 'pheatmap' wurde unter R Version 4.2.3 erstellt
my_palette <- colorRampPalette(c("blue", "white", "red"))(100)

hist_data_heatmap <- cor(hist_data[, c("Score", "GDP_per_capita",
            "Social_Support", "Life_Expectancy", "Life_choice", "Generosity",
            "Corruption", "Positive_affect", "Negative_affect")], method = "spearman")
hist_data_heatmap
##                      Score GDP_per_capita Social_Support Life_Expectancy
## Score            1.0000000     0.80823070     0.76936070       0.7844569
## GDP_per_capita   0.8082307     1.00000000     0.74920336       0.8762730
## Social_Support   0.7693607     0.74920336     1.00000000       0.6642157
## Life_Expectancy  0.7844569     0.87627295     0.66421569       1.0000000
## Life_choice      0.5472092     0.40220057     0.45529949       0.4066754
## Generosity       0.1644640     0.00651837     0.09984036       0.0559858
## Corruption      -0.3801773    -0.29546850    -0.22442361      -0.2732502
## Positive_affect  0.5072796     0.24939023     0.42048741       0.2625259
## Negative_affect -0.3162364    -0.30539295    -0.47610156      -0.1762606
##                 Life_choice  Generosity Corruption Positive_affect
## Score             0.5472092  0.16446404 -0.3801773       0.5072796
## GDP_per_capita    0.4022006  0.00651837 -0.2954685       0.2493902
## Social_Support    0.4552995  0.09984036 -0.2244236       0.4204874
## Life_Expectancy   0.4066754  0.05598580 -0.2732502       0.2625259
## Life_choice       1.0000000  0.34404499 -0.5001241       0.5617115
## Generosity        0.3440450  1.00000000 -0.2514402       0.3042992
## Corruption       -0.5001241 -0.25144018  1.0000000      -0.3120081
## Positive_affect   0.5617115  0.30429919 -0.3120081       1.0000000
## Negative_affect  -0.2446523 -0.08370886  0.2076119      -0.2749678
##                 Negative_affect
## Score               -0.31623637
## GDP_per_capita      -0.30539295
## Social_Support      -0.47610156
## Life_Expectancy     -0.17626063
## Life_choice         -0.24465231
## Generosity          -0.08370886
## Corruption           0.20761193
## Positive_affect     -0.27496775
## Negative_affect      1.00000000
pheatmap(hist_data_heatmap,
         color = my_palette,
         main = "Heatmap für die Daten 2006-2023")

kable(
  hist_data_heatmap[1, 2:9],
  col.names = c("Spearman corr"))
Spearman corr
GDP_per_capita 0.8082307
Social_Support 0.7693607
Life_Expectancy 0.7844569
Life_choice 0.5472092
Generosity 0.1644640
Corruption -0.3801773
Positive_affect 0.5072796
Negative_affect -0.3162364

Die Idee dieser Analyse, die Abhaengigkeiten zwischen der Glücklichkeitsrate (abhaengige Variabel) und den sozialoekonomischen Kennzahlen (unabhängige Variabeln) festzustellen. Die Frage heißt, inwiefern die sozialoekonomischen Kennzahlen die Glücklichkeitsrate erklären lassen. Allgemein aber wird aber die Gluecklichkeitsrate zum sehr grosen Maß durch die unabhaengige Variabel erklärt (78%).

library(knitr)
library(ggplot2)

hist_data_regmodel <- lm(
  Score ~ GDP_per_capita + Social_Support + Life_Expectancy + Life_choice + 
    Generosity + Corruption + Positive_affect + Negative_affect,
  hist_data)

round(summary(hist_data_regmodel)$adj.r.squared * 100, 2)
## [1] 78.41

Die Abhaengigkeiten zwischen einzelnen Variablen und der Rate sind aber unterschiedlich. Zum Beispiel weißt Generosity keinen monotonen Zusammenhang zur Glücksrate, wobei Korruption einen ungekehrten Zusammenhang aufweist. Deswegen setzen wir den Fokus auf GDP per capita, Social Support, Life Expectancy, Life choice und Positive Affect.

library(knitr)
library(ggplot2)

variables <- c("GDP_per_capita", "Social_Support", "Life_Expectancy", "Life_choice")

ggplot(hist_data, aes(x = Score, y = GDP_per_capita, color = Region)) +
    geom_point() +  
    geom_smooth(method = "lm", col = "red") +  
    labs(title = "Linear Regression", x = "Score", y = "GDP_per_capita")
## `geom_smooth()` using formula = 'y ~ x'

ggplot(hist_data, aes(x = Score, y = Social_Support, color = Region)) +
  geom_point() +  
  geom_smooth(method = "lm", col = "red") +  
  labs(title = "Linear Regression", x = "Score", y = "Social Support")
## `geom_smooth()` using formula = 'y ~ x'

ggplot(hist_data, aes(x = Score, y = Life_choice, color = Region)) +
  geom_point() + 
  geom_smooth(method = "lm", col = "red") +  
  labs(title = "Linear Regression", x = "Score", y = "Life Choice")
## `geom_smooth()` using formula = 'y ~ x'

ggplot(hist_data, aes(x = Score, y = Positive_affect, color = Region)) +
  geom_point() + 
  geom_smooth(method = "lm", col = "red") +  
  labs(title = "Linear Regression", x = "Score", y = "Positive affect")
## `geom_smooth()` using formula = 'y ~ x'

4.2 Dynamic der Werte

Wir berechnen R-Koeffiziente fuer einzelne unabhaengige Variable, um den Grad des Zusammenhangs mit der Gluecksrate zu bewerten. Tendenziell sind die Zusammenhaenge gleich geblieben, ausgenommen davon sind Social Support und Negative Affect, dessen Bedeutung zugenimmen hat.

results <- data.frame(
  Variable = character(), 
  Year = double(),
  R_Koeff = double()
)

for (variable in unique(variables)) {
  for (year in unique(hist_data$Year)) {
    model <- lm(as.formula(paste("Score ~", variable)), hist_data[hist_data$Year == year, ])
    coeff <- summary(model)$r.squared
    results <- rbind(results, data.frame(
    Variable = variable,
    Year = year,
    R_Koeff = coeff
  ))
  }
}

results <- 
  results |> 
    arrange(Variable, Year)

results
for (variable in variables) {
  results_spec <- results[results$Variable %in% variable, ]
  plot(results_spec$Year, results_spec$R_Koeff, type = "l", main = paste("R Koeff von", variable))
}

5. Fazit

6. Litaretur und Quellen