Data Preparation

Research question

Has the overall wealth/poverty divide in the world changed for better or worse in the past ~30 years?

Cases

Each case is an individual recording of a country, when the poverty report was done, along with the ratio/amount of people living below a certain standard. There are 4877 cases.

Data collection

The data was obtained from a public Kaggle dataset- https://www.kaggle.com/datasets/eishkaran/world-poverty-data

Type of study

This is an observational study.

Data Source

The data was obtained from a public Kaggle dataset- https://www.kaggle.com/datasets/eishkaran/world-poverty-data

Dependent Variable

The response variables are headcount_ratio_international_povline, headcount_ratio_lower_mid_income_povline, headcount_ratio_upper_mid_income_povline, which are the ratio headlines. Alternatively, we can look at the raw totals, rather than ratios, which are headcount_international_povline, headcount_lower_mid_income_povline, headcount_upper_mid_income_povline. There are several interesting dependent variables, and they all appear to be quantitative

Independent Variable(s)

country, year, reporting_level, survey_year

Relevant summary statistics

Provide summary statistics for each the variables. Also include appropriate visualizations related to your research question (e.g. scatter plot, boxplots, etc). This step requires the use of R, hence a code chunk is provided below. Insert more code chunks as needed.

Possibly needed libraries

library(jsonlite)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(ggplot2)
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ forcats   1.0.0     ✔ stringr   1.5.0
## ✔ lubridate 1.9.2     ✔ tibble    3.2.1
## ✔ purrr     1.0.1     ✔ tidyr     1.3.0
## ✔ readr     2.1.4
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter()  masks stats::filter()
## ✖ purrr::flatten() masks jsonlite::flatten()
## ✖ dplyr::lag()     masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(openintro)
## Loading required package: airports
## Loading required package: cherryblossom
## Loading required package: usdata
library(psych)
## 
## Attaching package: 'psych'
## 
## The following objects are masked from 'package:ggplot2':
## 
##     %+%, alpha

Load data and make into frame

poverty_raw <- read.csv(url("https://raw.githubusercontent.com/RonBalaban/CUNY-SPS-R/main/pip_dataset.csv"))
poverty_frame <- as.data.frame(poverty_raw)

head(poverty_frame)
##   country year reporting_level welfare_type ppp_version survey_year
## 1 Albania 1996        national  consumption        2011        1996
## 2 Albania 2002        national  consumption        2011        2002
## 3 Albania 2005        national  consumption        2011        2005
## 4 Albania 2008        national  consumption        2011        2008
## 5 Albania 2012        national  consumption        2011        2012
## 6 Albania 2014        national  consumption        2011        2014
##   survey_comparability headcount_ratio_international_povline
## 1                    0                             0.9206690
## 2                    1                             1.5708434
## 3                    1                             0.8605271
## 4                    1                             0.3136496
## 5                    1                             0.8497544
## 6                    2                             1.5808972
##   headcount_ratio_lower_mid_income_povline
## 1                                11.174149
## 2                                14.132118
## 3                                 8.715685
## 4                                 5.250542
## 5                                 6.182414
## 6                                11.615621
##   headcount_ratio_upper_mid_income_povline headcount_ratio_100
## 1                                 44.61842          0.05741581
## 2                                 49.66964          0.04637062
## 3                                 38.54525          0.02762022
## 4                                 31.11034          0.00000000
## 5                                 34.52891          0.11132100
## 6                                 37.03384          0.00000000
##   headcount_ratio_1000 headcount_ratio_2000 headcount_ratio_3000
## 1             86.17521             99.63208             99.91247
## 2             85.33832             98.08006             99.63839
## 3             79.98713             97.57660             99.43446
## 4             75.85102             97.09978             99.01586
## 5             77.06984             97.77263             99.61830
## 6             71.58569             95.18214             99.12649
##   headcount_ratio_4000 headcount_ratio_40_median headcount_ratio_50_median
## 1             99.95166                  2.768821                  7.548123
## 2             99.84308                  3.212283                  8.406373
## 3             99.75174                  4.095002                  8.991533
## 4             99.67825                  2.118535                  7.227714
## 5             99.88598                  3.492413                  7.753112
## 6             99.81976                  7.514618                 14.375828
##   headcount_ratio_60_median headcount_international_povline
## 1                  14.80251                           29167
## 2                  16.02055                           47927
## 3                  16.67577                           25915
## 4                  14.13715                            9244
## 5                  14.84282                           24646
## 6                  22.21602                           45674
##   headcount_lower_mid_income_povline headcount_upper_mid_income_povline
## 1                             354001                            1413526
## 2                             431172                            1515426
## 3                             262472                            1160785
## 4                             154750                             916920
## 5                             179315                            1001477
## 6                             335587                            1069946
##   headcount_100 headcount_1000 headcount_2000 headcount_3000 headcount_4000
## 1          1819        2730059        3156377        3165260        3166501
## 2          1415        2603681        2992432        3039977        3046222
## 3           832        2408802        2938507        2994456        3004011
## 4             0        2235568        2861836        2918308        2937831
## 5          3229        2235334        2835798        2889330        2897094
## 6             0        2068185        2749911        2863867        2883897
##   headcount_40_median headcount_50_median headcount_60_median
## 1               87717              239127              468949
## 2               98007              256479              488789
## 3              123320              270779              502189
## 4               62440              213023              416666
## 5              101294              224871              430501
## 6              217105              415333              641844
##   avg_shortfall_international_povline avg_shortfall_lower_mid_income_povline
## 1                           0.2890260                              0.5999076
## 2                           0.3166081                              0.6466790
## 3                           0.2899562                              0.6467713
## 4                           0.3104121                              0.4577278
## 5                           0.3781038                              0.6586981
## 6                           0.2546938                              0.7016316
##   avg_shortfall_upper_mid_income_povline avg_shortfall_100 avg_shortfall_1000
## 1                               1.583098        0.20422681           4.459419
## 2                               1.671541        0.53508932           4.719031
## 3                               1.514365        0.00832818           4.228461
## 4                               1.307345                NA           3.881222
## 5                               1.377123        0.10741674           4.030469
## 6                               1.742768                NA           4.431036
##   avg_shortfall_2000 avg_shortfall_3000 avg_shortfall_4000
## 1           13.50430           23.45916           33.44882
## 2           13.70162           23.42240           33.36826
## 3           12.91856           22.61159           32.52479
## 4           12.36353           22.06975           31.89560
## 5           12.54608           22.24632           32.17559
## 6           12.47453           21.84794           31.67118
##   avg_shortfall_40_median avg_shortfall_50_median avg_shortfall_60_median
## 1               0.3446150               0.4981147               0.6845159
## 2               0.3854980               0.5177960               0.6859527
## 3               0.4360586               0.6565995               0.8516646
## 4               0.4295745               0.5748611               0.8030727
## 5               0.5437887               0.7146906               0.8884043
## 6               0.5253690               0.7801093               1.0620848
##   total_shortfall_international_povline
## 1                              8430.020
## 2                             15174.078
## 3                              7514.215
## 4                              2869.449
## 5                              9318.746
## 6                             11632.883
##   total_shortfall_lower_mid_income_povline
## 1                                212367.88
## 2                                278829.87
## 3                                169759.35
## 4                                 70833.38
## 5                                118114.46
## 6                                235458.46
##   total_shortfall_upper_mid_income_povline total_shortfall_100
## 1                                  2237750          371.488565
## 2                                  2533096          757.151389
## 3                                  1757852            6.929046
## 4                                  1198731            0.000000
## 5                                  1379157          346.848655
## 6                                  1864668            0.000000
##   total_shortfall_1000 total_shortfall_2000 total_shortfall_3000
## 1             12174477             42624656             74254340
## 2             12286852             41001158             71203557
## 3             10185526             37961293             67709400
## 4              8676735             35382386             64406320
## 5              9009444             35578150             64276958
## 6              9164201             34303852             62569586
##   total_shortfall_4000 total_shortfall_40_median total_shortfall_50_median
## 1            105915713                  30228.59                  119112.7
## 2            101647115                  37781.50                  132803.8
## 3             97704835                  53774.75                  177793.4
## 4             93703870                  26822.63                  122458.6
## 5             93215717                  55082.53                  160713.2
## 6             91336415                 114060.23                  324005.1
##   total_shortfall_60_median income_gap_ratio_international_povline
## 1                  321003.0                               15.21189
## 2                  335286.1                               16.66359
## 3                  427696.6                               15.26085
## 4                  334613.1                               16.33748
## 5                  382458.9                               19.90020
## 6                  681692.8                               13.40493
##   income_gap_ratio_lower_mid_income_povline
## 1                                  18.74711
## 2                                  20.20872
## 3                                  20.21160
## 4                                  14.30399
## 5                                  20.58432
## 6                                  21.92599
##   income_gap_ratio_upper_mid_income_povline income_gap_ratio_100
## 1                                  28.78360            20.422681
## 2                                  30.39165            53.508932
## 3                                  27.53390             0.832818
## 4                                  23.76991                   NA
## 5                                  25.03859            10.741674
## 6                                  31.68669                   NA
##   income_gap_ratio_1000 income_gap_ratio_2000 income_gap_ratio_3000
## 1              44.59419              67.52149              78.19720
## 2              47.19031              68.50809              78.07467
## 3              42.28461              64.59282              75.37195
## 4              38.81222              61.81763              73.56582
## 5              40.30469              62.73040              74.15440
## 6              44.31036              62.37266              72.82646
##   income_gap_ratio_4000 income_gap_ratio_40_median income_gap_ratio_50_median
## 1              83.62204                   14.91890                   17.25131
## 2              83.42064                   17.39735                   18.69432
## 3              81.31198                   16.87440                   20.32703
## 4              79.73899                   15.43531                   16.52455
## 5              80.43898                   19.91816                   20.94243
## 6              79.17794                   19.11590                   22.70784
##   income_gap_ratio_60_median poverty_gap_index_international_povline
## 1                   19.75582                              0.14005071
## 2                   20.63782                              0.26176109
## 3                   21.97156                              0.13132549
## 4                   19.23714                              0.05124112
## 5                   21.69394                              0.16910086
## 6                   25.76311                              0.21191933
##   poverty_gap_index_lower_mid_income_povline
## 1                                  2.0948318
## 2                                  2.8559177
## 3                                  1.7615814
## 4                                  0.7510374
## 5                                  1.2726091
## 6                                  2.5468370
##   poverty_gap_index_upper_mid_income_povline poverty_gap_index_100
## 1                                  12.842785          0.0117261583
## 2                                  15.095426          0.0248164178
## 3                                  10.613009          0.0002300872
## 4                                   7.394906          0.0000000000
## 5                                   8.645555          0.0119586449
## 6                                  11.734796          0.0000000000
##   poverty_gap_index_1000 poverty_gap_index_2000 poverty_gap_index_3000
## 1               38.42913               67.27306               78.12875
## 2               40.27143               67.19276               77.79233
## 3               33.82225               63.02749               74.94570
## 4               29.43947               60.02480               72.84183
## 5               31.06275               61.33316               73.87135
## 6               31.71987               59.36763               72.19030
##   poverty_gap_index_4000     mean   median decile1_avg decile2_avg decile3_avg
## 1               83.58161 6.570821 5.774805    2.538496    3.475535    4.191319
## 2               83.28973 6.715828 5.539607    2.346511    3.263519    3.923426
## 3               81.11013 7.591930 6.460357    2.643917    3.735312    4.537911
## 4               79.48243 8.314345 6.957659    3.104265    4.270897    5.062166
## 5               80.34727 7.882867 6.825289    2.884756    4.093648    4.842953
## 6               79.03524 8.399775 6.870837    2.396459    3.505870    4.387129
##   decile4_avg decile5_avg decile6_avg decile7_avg decile8_avg decile9_avg
## 1    4.811182    5.506126    6.146939    7.111657    8.196356    9.790226
## 2    4.525262    5.139692    5.936429    6.869341    8.048536   10.023425
## 3    5.254513    6.064554    6.860879    7.874459    9.206284   11.261826
## 4    5.806393    6.578375    7.419832    8.562724    9.918245   12.085071
## 5    5.542227    6.372377    7.297124    8.289193    9.690645   11.736908
## 6    5.301601    6.310224    7.503401    8.898472   10.688325   13.549610
##   decile10_avg decile1_share decile2_share decile3_share decile4_share
## 1     13.94037      3.863286      5.289347      6.378683      7.322042
## 2     17.08214      3.494002      4.859444      5.842059      6.738204
## 3     18.47964      3.482536      4.920109      5.977283      6.921183
## 4     20.33548      3.733625      5.136781      6.088472      6.983584
## 5     18.07883      3.659527      5.193095      6.143644      7.030726
## 6     21.45666      2.853004      4.173767      5.222913      6.311599
##   decile5_share decile6_share decile7_share decile8_share decile9_share
## 1      8.379662      9.354903      10.82309      12.47387      14.89955
## 2      7.653102      8.839459      10.22859      11.98443      14.92508
## 3      7.988158      9.037069      10.37214      12.12641      14.83394
## 4      7.912079      8.924133      10.29873      11.92908      14.53520
## 5      8.083833      9.256943      10.51546      12.29330      14.88914
## 6      7.512373      8.932860      10.59370      12.72454      16.13092
##   decile10_share decile1_thr decile2_thr decile3_thr decile4_thr decile6_thr
## 1       21.21557        3.06        3.88        4.48        5.16        6.66
## 2       25.43564        2.91        3.62        4.22        4.85        6.35
## 3       24.34117        3.30        4.18        4.93        5.63        7.32
## 4       24.45831        3.81        4.70        5.43        6.20        7.93
## 5       22.93434        3.65        4.49        5.17        5.93        7.74
## 6       25.54432        3.05        3.96        4.82        5.82        8.14
##   decile7_thr decile8_thr decile9_thr      gini       mld polarization
## 1        7.61        8.85       10.92 0.2701034 0.1191043    0.2412933
## 2        7.38        8.83       11.58 0.3173898 0.1648116    0.2689816
## 3        8.51       10.02       12.78 0.3059566 0.1544128    0.2545287
## 4        9.24       10.74       13.62 0.2998467 0.1488934    0.2473111
## 5        8.91       10.52       13.26 0.2896048 0.1384171    0.2499879
## 6        9.71       11.74       15.78 0.3459890 0.1986616    0.3243097
##   palma_ratio s80_s20_ratio p90_p10_ratio p90_p50_ratio p50_p10_ratio
## 1   0.9283351      3.945872      3.568627      1.889273      1.888889
## 2   1.2150564      4.831625      3.979381      2.090253      1.903780
## 3   1.1427183      4.662236      3.872727      1.978328      1.957576
## 4   1.1146566      4.395911      3.574803      1.956897      1.826772
## 5   1.0411926      4.272573      3.632877      1.941435      1.871233
## 6   1.3762154      5.930924      5.173770      2.296943      2.252459

Simple summary statistics

summary(poverty_frame)
##    country               year      reporting_level    welfare_type      
##  Length:4877        Min.   :1967   Length:4877        Length:4877       
##  Class :character   1st Qu.:2000   Class :character   Class :character  
##  Mode  :character   Median :2007   Mode  :character   Mode  :character  
##                     Mean   :2006                                        
##                     3rd Qu.:2013                                        
##                     Max.   :2021                                        
##                                                                         
##   ppp_version    survey_year   survey_comparability
##  Min.   :2011   Min.   :1967   Min.   :0.000       
##  1st Qu.:2011   1st Qu.:2000   1st Qu.:1.000       
##  Median :2011   Median :2007   Median :1.000       
##  Mean   :2014   Mean   :2006   Mean   :1.639       
##  3rd Qu.:2017   3rd Qu.:2014   3rd Qu.:2.000       
##  Max.   :2017   Max.   :2021   Max.   :6.000       
##                 NA's   :466    NA's   :466         
##  headcount_ratio_international_povline headcount_ratio_lower_mid_income_povline
##  Min.   : 0.0000                       Min.   :  0.0000                        
##  1st Qu.: 0.2784                       1st Qu.:  0.8079                        
##  Median : 2.0414                       Median :  9.1867                        
##  Mean   :11.0816                       Mean   : 21.6727                        
##  3rd Qu.:13.3910                       3rd Qu.: 34.1667                        
##  Max.   :96.8714                       Max.   : 99.9990                        
##                                                                                
##  headcount_ratio_upper_mid_income_povline headcount_ratio_100
##  Min.   :  0.000                          Min.   : 0.00000   
##  1st Qu.:  3.032                          1st Qu.: 0.04477   
##  Median : 28.583                          Median : 0.37176   
##  Mean   : 36.539                          Mean   : 3.16472   
##  3rd Qu.: 64.865                          3rd Qu.: 2.15848   
##  Max.   : 99.999                          Max.   :79.53262   
##                                                              
##  headcount_ratio_1000 headcount_ratio_2000 headcount_ratio_3000
##  Min.   :  0.00       Min.   :  0.9202     Min.   :  6.083     
##  1st Qu.: 10.33       1st Qu.: 44.5759     1st Qu.: 71.017     
##  Median : 55.34       Median : 84.9163     Median : 93.503     
##  Mean   : 50.35       Mean   : 69.1060     Mean   : 79.081     
##  3rd Qu.: 85.13       3rd Qu.: 97.1794     3rd Qu.: 99.113     
##  Max.   :100.00       Max.   :100.0000     Max.   :100.000     
##                                                                
##  headcount_ratio_4000 headcount_ratio_40_median headcount_ratio_50_median
##  Min.   : 14.10       Min.   : 0.000            Min.   : 0.8776          
##  1st Qu.: 84.25       1st Qu.: 3.973            1st Qu.: 8.8660          
##  Median : 96.67       Median : 6.596            Median :12.6409          
##  Mean   : 85.72       Mean   : 8.015            Mean   :13.4216          
##  3rd Qu.: 99.61       3rd Qu.:11.559            3rd Qu.:17.9596          
##  Max.   :100.00       Max.   :36.163            Max.   :38.9103          
##                       NA's   :466               NA's   :466              
##  headcount_ratio_60_median headcount_international_povline
##  Min.   : 4.892            Min.   :0.000e+00              
##  1st Qu.:15.583            1st Qu.:2.121e+04              
##  Median :19.610            Median :3.615e+05              
##  Mean   :20.071            Mean   :4.456e+07              
##  3rd Qu.:24.748            3rd Qu.:5.160e+06              
##  Max.   :41.442            Max.   :2.005e+09              
##  NA's   :466                                              
##  headcount_lower_mid_income_povline headcount_upper_mid_income_povline
##  Min.   :0.000e+00                  Min.   :0.000e+00                 
##  1st Qu.:8.558e+04                  1st Qu.:3.214e+05                 
##  Median :1.027e+06                  Median :2.863e+06                 
##  Mean   :8.632e+07                  Mean   :1.264e+08                 
##  3rd Qu.:1.099e+07                  3rd Qu.:2.006e+07                 
##  Max.   :3.156e+09                  Max.   :4.244e+09                 
##                                                                       
##  headcount_100       headcount_1000      headcount_2000     
##  Min.   :        0   Min.   :0.000e+00   Min.   :3.736e+03  
##  1st Qu.:     2694   1st Qu.:8.784e+05   1st Qu.:2.499e+06  
##  Median :    63838   Median :4.951e+06   Median :8.313e+06  
##  Mean   :  9676924   Mean   :1.522e+08   Mean   :1.787e+08  
##  3rd Qu.:   895900   3rd Qu.:3.226e+07   3rd Qu.:5.391e+07  
##  Max.   :569231470   Max.   :4.833e+09   Max.   :6.010e+09  
##                                                             
##  headcount_3000      headcount_4000      headcount_40_median
##  Min.   :9.913e+03   Min.   :1.006e+04   Min.   :        0  
##  1st Qu.:3.069e+06   1st Qu.:3.674e+06   1st Qu.:   259948  
##  Median :1.051e+07   Median :1.216e+07   Median :   859900  
##  Mean   :1.907e+08   Mean   :1.987e+08   Mean   :  4501881  
##  3rd Qu.:6.368e+07   3rd Qu.:6.902e+07   3rd Qu.:  3269602  
##  Max.   :6.544e+09   Max.   :6.868e+09   Max.   :176375997  
##                                          NA's   :466        
##  headcount_50_median headcount_60_median avg_shortfall_international_povline
##  Min.   :     1195   Min.   :     1847   Min.   :0.00443                    
##  1st Qu.:   497663   1st Qu.:   787206   1st Qu.:0.45363                    
##  Median :  1489600   Median :  2233892   Median :0.69507                    
##  Mean   :  8382880   Mean   : 13254819   Mean   :0.77819                    
##  3rd Qu.:  6392031   3rd Qu.: 10529900   3rd Qu.:1.00221                    
##  Max.   :268177618   Max.   :358853136   Max.   :2.15893                    
##  NA's   :466         NA's   :466         NA's   :291                        
##  avg_shortfall_lower_mid_income_povline avg_shortfall_upper_mid_income_povline
##  Min.   :0.00523                        Min.   :0.05913                       
##  1st Qu.:0.92154                        1st Qu.:1.96546                       
##  Median :1.28584                        Median :2.59216                       
##  Mean   :1.34847                        Mean   :2.67004                       
##  3rd Qu.:1.68015                        3rd Qu.:3.30440                       
##  Max.   :3.64996                        Max.   :6.84993                       
##  NA's   :100                            NA's   :12                            
##  avg_shortfall_100 avg_shortfall_1000 avg_shortfall_2000 avg_shortfall_3000
##  Min.   :0.0013    Min.   : 1.290     Min.   : 1.860     Min.   : 4.758    
##  1st Qu.:0.2183    1st Qu.: 3.507     1st Qu.: 7.188     1st Qu.:12.650    
##  Median :0.3542    Median : 4.541     Median :11.288     Median :19.992    
##  Mean   :0.4186    Mean   : 4.756     Mean   :11.127     Mean   :18.652    
##  3rd Qu.:0.6007    3rd Qu.: 5.790     3rd Qu.:14.530     3rd Qu.:24.134    
##  Max.   :1.0101    Max.   :10.000     Max.   :20.000     Max.   :30.000    
##  NA's   :750       NA's   :6                                               
##  avg_shortfall_4000 avg_shortfall_40_median avg_shortfall_50_median
##  Min.   : 8.731     Min.   :0.0419          Min.   : 0.0498        
##  1st Qu.:19.908     1st Qu.:0.4396          1st Qu.: 0.6074        
##  Median :29.330     Median :1.0867          Median : 1.4246        
##  Mean   :26.875     Mean   :1.8868          Mean   : 2.3040        
##  3rd Qu.:33.972     3rd Qu.:2.7650          3rd Qu.: 3.4442        
##  Max.   :40.000     Max.   :9.2963          Max.   :11.3676        
##                     NA's   :468             NA's   :466            
##  avg_shortfall_60_median total_shortfall_international_povline
##  Min.   : 0.0839         Min.   :0.000e+00                    
##  1st Qu.: 0.8007         1st Qu.:1.521e+04                    
##  Median : 1.8008         Median :2.314e+05                    
##  Mean   : 2.8122         Mean   :2.948e+07                    
##  3rd Qu.: 4.1505         3rd Qu.:3.632e+06                    
##  Max.   :14.2995         Max.   :1.583e+09                    
##  NA's   :466                                                  
##  total_shortfall_lower_mid_income_povline
##  Min.   :0.000e+00                       
##  1st Qu.:9.872e+04                       
##  Median :1.252e+06                       
##  Mean   :1.239e+08                       
##  3rd Qu.:1.598e+07                       
##  Max.   :5.480e+09                       
##                                          
##  total_shortfall_upper_mid_income_povline total_shortfall_100
##  Min.   :0.000e+00                        Min.   :        0  
##  1st Qu.:6.856e+05                        1st Qu.:      906  
##  Median :6.607e+06                        Median :    22392  
##  Mean   :4.265e+08                        Mean   :  2757883  
##  3rd Qu.:6.025e+07                        3rd Qu.:   324459  
##  Max.   :1.730e+10                        Max.   :158089241  
##                                                              
##  total_shortfall_1000 total_shortfall_2000 total_shortfall_3000
##  Min.   :0.000e+00    Min.   :9.589e+03    Min.   :1.653e+05   
##  1st Qu.:2.993e+06    1st Qu.:2.209e+07    1st Qu.:5.547e+07   
##  Median :2.332e+07    Median :9.120e+07    Median :1.914e+08   
##  Mean   :9.689e+08    Mean   :2.660e+09    Mean   :4.529e+09   
##  3rd Qu.:1.570e+08    3rd Qu.:6.277e+08    3rd Qu.:1.194e+09   
##  Max.   :3.257e+10    Max.   :8.363e+10    Max.   :1.440e+11   
##                                                                
##  total_shortfall_4000 total_shortfall_40_median total_shortfall_50_median
##  Min.   :3.207e+05    Min.   :        0         Min.   :      758        
##  1st Qu.:9.264e+07    1st Qu.:   213643         1st Qu.:   598908        
##  Median :3.330e+08    Median :   967355         Median :  2133861        
##  Mean   :6.495e+09    Mean   :  7901541         Mean   : 16305022        
##  3rd Qu.:1.846e+09    3rd Qu.:  3581223         3rd Qu.:  7914232        
##  Max.   :2.112e+11    Max.   :366229625         Max.   :690458017        
##                       NA's   :466               NA's   :466              
##  total_shortfall_60_median income_gap_ratio_international_povline
##  Min.   :1.654e+03         Min.   :  0.2058                      
##  1st Qu.:1.220e+06         1st Qu.: 22.4091                      
##  Median :4.266e+06         Median : 34.4059                      
##  Mean   :2.952e+07         Mean   : 38.4236                      
##  3rd Qu.:1.553e+07         3rd Qu.: 49.8513                      
##  Max.   :1.156e+09         Max.   :100.4155                      
##  NA's   :466               NA's   :291                           
##  income_gap_ratio_lower_mid_income_povline
##  Min.   :  0.1633                         
##  1st Qu.: 26.8856                         
##  Median : 37.5422                         
##  Mean   : 39.3608                         
##  3rd Qu.: 49.0408                         
##  Max.   : 99.9990                         
##  NA's   :100                              
##  income_gap_ratio_upper_mid_income_povline income_gap_ratio_100
##  Min.   :  1.075                           Min.   :  0.1339    
##  1st Qu.: 32.666                           1st Qu.: 21.8340    
##  Median : 42.025                           Median : 35.4210    
##  Mean   : 43.188                           Mean   : 41.8600    
##  3rd Qu.: 53.368                           3rd Qu.: 60.0720    
##  Max.   : 99.999                           Max.   :101.0080    
##  NA's   :12                                NA's   :750         
##  income_gap_ratio_1000 income_gap_ratio_2000 income_gap_ratio_3000
##  Min.   : 12.90        Min.   :  9.30        Min.   : 15.86       
##  1st Qu.: 35.07        1st Qu.: 35.94        1st Qu.: 42.17       
##  Median : 45.41        Median : 56.44        Median : 66.64       
##  Mean   : 47.56        Mean   : 55.63        Mean   : 62.17       
##  3rd Qu.: 57.90        3rd Qu.: 72.65        3rd Qu.: 80.45       
##  Max.   :100.00        Max.   :100.00        Max.   :100.00       
##  NA's   :6                                                        
##  income_gap_ratio_4000 income_gap_ratio_40_median income_gap_ratio_50_median
##  Min.   : 21.83        Min.   : 6.377             Min.   : 7.987            
##  1st Qu.: 49.77        1st Qu.:19.779             1st Qu.:21.340            
##  Median : 73.32        Median :26.196             Median :26.726            
##  Mean   : 67.19        Mean   :27.359             Mean   :27.901            
##  3rd Qu.: 84.93        3rd Qu.:34.351             3rd Qu.:33.838            
##  Max.   :100.00        Max.   :74.986             Max.   :67.338            
##                        NA's   :468                NA's   :466               
##  income_gap_ratio_60_median poverty_gap_index_international_povline
##  Min.   :10.00              Min.   : 0.0000                        
##  1st Qu.:23.17              1st Qu.: 0.1245                        
##  Median :27.65              Median : 0.6422                        
##  Mean   :29.09              Mean   : 4.0624                        
##  3rd Qu.:34.74              3rd Qu.: 4.0977                        
##  Max.   :68.85              Max.   :64.0970                        
##  NA's   :466                                                       
##  poverty_gap_index_lower_mid_income_povline
##  Min.   :  0.0000                          
##  1st Qu.:  0.3387                          
##  Median :  2.5326                          
##  Mean   :  9.1830                          
##  3rd Qu.: 12.4506                          
##  Max.   : 99.9980                          
##                                            
##  poverty_gap_index_upper_mid_income_povline poverty_gap_index_100
##  Min.   :  0.000                            Min.   : 0.00000     
##  1st Qu.:  1.055                            1st Qu.: 0.01365     
##  Median :  9.779                            Median : 0.14990     
##  Mean   : 18.266                            Mean   : 1.13075     
##  3rd Qu.: 29.319                            3rd Qu.: 0.72813     
##  Max.   : 99.998                            Max.   :41.98930     
##                                                                  
##  poverty_gap_index_1000 poverty_gap_index_2000 poverty_gap_index_3000
##  Min.   :  0.000        Min.   :  0.1239       Min.   :  1.265       
##  1st Qu.:  3.154        1st Qu.: 15.0396       1st Qu.: 30.222       
##  Median : 22.685        Median : 48.6546       Median : 62.493       
##  Mean   : 28.252        Mean   : 44.7445       Mean   : 54.781       
##  3rd Qu.: 46.917        3rd Qu.: 69.3674       3rd Qu.: 78.971       
##  Max.   : 99.998        Max.   : 99.9980       Max.   : 99.998       
##                                                                      
##  poverty_gap_index_4000      mean            median         decile1_avg    
##  Min.   :  3.656        Min.   : 0.743   Min.   : 0.5282   Min.   : 0.000  
##  1st Qu.: 42.380        1st Qu.: 6.580   1st Qu.: 4.6592   1st Qu.: 1.391  
##  Median : 70.682        Median :12.846   Median : 9.1076   Median : 2.959  
##  Mean   : 61.831        Mean   :19.749   Mean   :15.8058   Mean   : 5.671  
##  3rd Qu.: 84.150        3rd Qu.:26.632   3rd Qu.:21.6472   3rd Qu.: 7.463  
##  Max.   : 99.998        Max.   :85.875   Max.   :69.4836   Max.   :26.906  
##                                                            NA's   :482     
##   decile2_avg       decile3_avg       decile4_avg       decile5_avg     
##  Min.   : 0.1529   Min.   : 0.2382   Min.   : 0.3429   Min.   : 0.4755  
##  1st Qu.: 2.2762   1st Qu.: 2.9703   1st Qu.: 3.6998   1st Qu.: 4.5085  
##  Median : 4.7560   Median : 6.1963   Median : 7.5307   Median : 8.9686  
##  Mean   : 8.9950   Mean   :11.1980   Mean   :13.2337   Mean   :15.3432  
##  3rd Qu.:12.4957   3rd Qu.:15.6662   3rd Qu.:18.4650   3rd Qu.:21.2789  
##  Max.   :40.5614   Max.   :49.1261   Max.   :56.0456   Max.   :64.6635  
##  NA's   :482       NA's   :482       NA's   :482       NA's   :482      
##   decile6_avg       decile7_avg       decile8_avg        decile9_avg     
##  Min.   : 0.5807   Min.   : 0.7132   Min.   :  0.8907   Min.   :  1.196  
##  1st Qu.: 5.3870   1st Qu.: 6.4734   1st Qu.:  7.9534   1st Qu.: 10.491  
##  Median :10.7406   Median :12.7560   Median : 15.7568   Median : 21.003  
##  Mean   :17.7250   Mean   :20.6274   Mean   : 24.5551   Mean   : 30.903  
##  3rd Qu.:24.6651   3rd Qu.:28.7787   3rd Qu.: 34.2894   3rd Qu.: 43.572  
##  Max.   :74.9081   Max.   :88.7781   Max.   :106.7388   Max.   :139.220  
##  NA's   :482       NA's   :482       NA's   :482        NA's   :482      
##   decile10_avg     decile1_share   decile2_share   decile3_share  
##  Min.   :  1.995   Min.   :0.000   Min.   :0.760   Min.   :1.587  
##  1st Qu.: 20.327   1st Qu.:1.877   1st Qu.:3.339   1st Qu.:4.379  
##  Median : 42.430   Median :2.718   Median :4.253   Median :5.369  
##  Mean   : 55.409   Mean   :2.631   Mean   :4.096   Mean   :5.134  
##  3rd Qu.: 79.494   3rd Qu.:3.394   3rd Qu.:4.971   3rd Qu.:6.018  
##  Max.   :264.254   Max.   :5.494   Max.   :6.876   Max.   :7.690  
##  NA's   :482       NA's   :482     NA's   :482     NA's   :482    
##  decile4_share   decile5_share   decile6_share    decile7_share   
##  Min.   :2.549   Min.   :3.310   Min.   : 4.204   Min.   : 5.248  
##  1st Qu.:5.414   1st Qu.:6.530   1st Qu.: 7.836   1st Qu.: 9.449  
##  Median :6.388   Median :7.450   Median : 8.628   Median :10.085  
##  Mean   :6.121   Mean   :7.165   Mean   : 8.361   Mean   : 9.844  
##  3rd Qu.:6.961   3rd Qu.:7.963   3rd Qu.: 9.101   3rd Qu.:10.423  
##  Max.   :8.420   Max.   :9.142   Max.   :10.044   Max.   :11.636  
##  NA's   :482     NA's   :482     NA's   :482      NA's   :482     
##  decile8_share    decile9_share    decile10_share   decile1_thr   
##  Min.   : 6.501   Min.   : 8.778   Min.   :16.99   Min.   : 0.01  
##  1st Qu.:11.614   1st Qu.:14.672   1st Qu.:24.48   1st Qu.: 1.79  
##  Median :11.998   Median :15.287   Median :27.49   Median : 3.57  
##  Mean   :11.891   Mean   :15.322   Mean   :29.43   Mean   : 7.34  
##  3rd Qu.:12.248   3rd Qu.:15.918   3rd Qu.:32.90   3rd Qu.: 9.85  
##  Max.   :13.843   Max.   :18.950   Max.   :61.49   Max.   :35.50  
##  NA's   :482      NA's   :482      NA's   :482                    
##   decile2_thr      decile3_thr     decile4_thr     decile6_thr   
##  Min.   : 0.010   Min.   : 0.15   Min.   : 0.39   Min.   : 0.64  
##  1st Qu.: 2.480   1st Qu.: 3.13   1st Qu.: 3.85   1st Qu.: 5.61  
##  Median : 5.010   Median : 6.30   Median : 7.62   Median :10.96  
##  Mean   : 9.677   Mean   :11.67   Mean   :13.65   Mean   :18.33  
##  3rd Qu.:13.300   3rd Qu.:15.88   3rd Qu.:18.64   3rd Qu.:25.12  
##  Max.   :45.400   Max.   :52.45   Max.   :60.15   Max.   :81.50  
##                                                                  
##   decile7_thr     decile8_thr      decile9_thr          gini       
##  Min.   : 0.79   Min.   :  1.01   Min.   :  1.46   Min.   :0.1779  
##  1st Qu.: 6.82   1st Qu.:  8.68   1st Qu.: 11.96   1st Qu.:0.3087  
##  Median :13.32   Median : 16.98   Median : 24.56   Median :0.3556  
##  Mean   :21.56   Mean   : 26.27   Mean   : 35.11   Mean   :0.3756  
##  3rd Qu.:29.48   3rd Qu.: 35.55   3rd Qu.: 48.35   3rd Qu.:0.4277  
##  Max.   :96.85   Max.   :120.10   Max.   :164.70   Max.   :0.6576  
##                                                    NA's   :476     
##       mld          polarization     palma_ratio     s80_s20_ratio   
##  Min.   :0.0536   Min.   :0.1466   Min.   :0.5964   Min.   : 2.430  
##  1st Qu.:0.1631   1st Qu.:0.2524   1st Qu.:1.1541   1st Qu.: 4.721  
##  Median :0.2210   Median :0.3004   Median :1.4658   Median : 6.172  
##  Mean   :0.2644   Mean   :0.3274   Mean   :1.8865   Mean   : 8.220  
##  3rd Qu.:0.3209   3rd Qu.:0.3802   3rd Qu.:2.1521   3rd Qu.: 9.043  
##  Max.   :0.9370   Max.   :0.8157   Max.   :8.3436   Max.   :72.682  
##  NA's   :476      NA's   :476      NA's   :482      NA's   :482     
##  p90_p10_ratio      p90_p50_ratio    p50_p10_ratio    
##  Min.   :   2.191   Min.   : 1.475   Min.   :  1.485  
##  1st Qu.:   3.938   1st Qu.: 2.018   1st Qu.:  1.942  
##  Median :   5.150   Median : 2.290   Median :  2.208  
##  Mean   :   7.425   Mean   : 2.532   Mean   :  2.660  
##  3rd Qu.:   7.458   3rd Qu.: 2.781   3rd Qu.:  2.740  
##  Max.   :2892.000   Max.   :11.492   Max.   :809.000  
## 
#-------------------------------------------------------------------------------
# The variables I'm most interested in
describe(poverty_frame$headcount_ratio_international_povline)
##    vars    n  mean    sd median trimmed mad min   max range skew kurtosis   se
## X1    1 4877 11.08 18.19   2.04    6.62   3   0 96.87 96.87 2.12     3.94 0.26
describe(poverty_frame$headcount_ratio_lower_mid_income_povline)
##    vars    n  mean   sd median trimmed   mad min max range skew kurtosis   se
## X1    1 4877 21.67 27.1   9.19   16.77 13.25   0 100   100 1.25     0.32 0.39
describe(poverty_frame$headcount_ratio_upper_mid_income_povline)
##    vars    n  mean    sd median trimmed   mad min max range skew kurtosis   se
## X1    1 4877 36.54 33.67  28.58   33.76 40.06   0 100   100 0.48     -1.2 0.48

Cleaning data, as some elements are messy

for (i in poverty_frame\(headcount_ratio_international_povline) { if (poverty_frame\)headcount_ratio_international_povline > 1){ poverty_frame\(headcount_ratio_international_povline <- poverty_frame\)headcount_ratio_international_povline/100 }}