Select Lorenz function
Source:vignettes/review_gd_compute_pip_stats.Rmd
review_gd_compute_pip_stats.Rmd
Background
Povcalnet uses two methods to estimate poverty and inequality statistics from grouped data.
- One method is based on fitting a Lorenz Quadratic functional form to
the grouped data
- the other one uses a Beta Lorenz function
Povcalnet then choose the statistics to be returned based on a set of rules.
This vignette focuses on the higher level
gd_compute_pip_stats()
function that handles the
application of both functional forms and the selection of the final
results.
High level example
# Input definition
welfare_mean <- 51.56
ppp <- 3.69
daily_povline <- 1.9
monthly_povline <- daily_povline * 365 / 12
# Create grouped data (Type 1)
# http://iresearch.worldbank.org/povcalnet/PovCalculator.aspx
population <- c(0.0005,
0.0032,
0.014799999999999999,
0.0443,
0.0991,
0.257,
0.4385,
0.5938,
0.7089,
1)
welfare <- c(5.824760527229386e-05,
0.000604029410841011,
0.0037949334793616948,
0.013988878652244477,
0.036992164583098786,
0.12140708906131342,
0.24531391873082081,
0.37446670169288321,
0.48753116241194566,
1)
# Estimate poverty statistics
out <- wbpip:::gd_compute_pip_stats(welfare = welfare,
population = population,
requested_mean = welfare_mean,
povline = monthly_povline,
default_ppp = ppp)
out
#> $poverty_line
#> [1] 57.79167
#>
#> $mean
#> [1] 51.56
#>
#> $median
#> [1] 42.58973
#>
#> $headcount
#> [1] 0.7184622
#>
#> $poverty_gap
#> [1] 0.2714275
#>
#> $poverty_severity
#> [1] 0.1293701
#>
#> $watts
#> [1] 0.3788881
#>
#> $gini
#> [1] 0.3123674
#>
#> $mld
#> [1] 0.1633424
#>
#> $polarization
#> [1] 0.2556375
#>
#> $deciles
#> [1] 0.03750486 0.04963605 0.05871314 0.06775231 0.07741935 0.08831018
#> [7] 0.10132911 0.11835493 0.14500187 0.25597820