PovertyAndInequalityMeasures
This generates various measures poverty and inequality from a sample dataset.
The measures are mostly taken from chs. 4-6 of the World Banks' Handbook on Poverty and Inequality.
See the test case for worked examples
Poverty measures are:
headcount
;gap
;Foster Greer Thorndyke
, for each of the values infoster_greer_thorndyke_alphas
- note that α=0 is headcount and α=1 is gap;Watts
;time to exit
, for the supplied growth rate;Shorrocks
;Sen
.
See WB ch. 4 on these measures.
Inequality Measures Are:
Gini
;Atkinson
, for each value inatkinson_es
;Theil
;generalised_entropy
;Hoover
;Theil
;Palma
.
See World Bank chs. 5 an 6, and Cobham and Sumner on the Palma. Also returned by the inequality function are:
total_income
total_population
average_income
deciles
.
There's also a small binify
routine which chops a dataset up into chunks of cumulative income and population suitable for drawing Lorenz Curves.
Index
PovertyAndInequalityMeasures.add_decomposed_theil
PovertyAndInequalityMeasures.binify
PovertyAndInequalityMeasures.binify
PovertyAndInequalityMeasures.make_all_below_line
PovertyAndInequalityMeasures.make_augmented
PovertyAndInequalityMeasures.make_augmented
PovertyAndInequalityMeasures.make_gini
PovertyAndInequalityMeasures.make_inequality
PovertyAndInequalityMeasures.make_inequality
PovertyAndInequalityMeasures.make_inequalityinternal
PovertyAndInequalityMeasures.make_poverty
PovertyAndInequalityMeasures.make_poverty
PovertyAndInequalityMeasures.make_povertyinternal
PovertyAndInequalityMeasures.add_decomposed_theil
— MethodMake a wee dict with :theilbetween and :theilwithin See WB eqns 6.7/6.8. TODO
- there are some papers on decomposing Atkinson, but I
don't understand them ..
- the over time 3-part version
popindc : Inequal for the population as a whole subindices : an array of dics, one for each subgroup of interest
PovertyAndInequalityMeasures.binify
— FunctionChop a dataset with populations and incomes into numbins groups in a form suitable for e.g. a Gini curve.
- col1 is cumulative population,
- 2 cumulative income/whatever,
- 3 threshold income level.
PovertyAndInequalityMeasures.binify
— MethodAs above, but using any DataFrame like thing that supports the TableTraits.isiterabletable interface
PovertyAndInequalityMeasures.make_all_below_line
— Methodgenerate a subset of one of our datasets with just the elements whose incomes are below the line. Probably possible in 1 line, once I get the hang of this a bit more.
PovertyAndInequalityMeasures.make_augmented
— Functioninternal function that makes a sorted array with cumulative income and population added
PovertyAndInequalityMeasures.make_augmented
— Methodinternal function that makes a sorted array with cumulative income and population added
PovertyAndInequalityMeasures.make_gini
— Methodcalculate a Gini coefficient on one of our sorted arrays
PovertyAndInequalityMeasures.make_inequality
— FunctionMake a struct of inequality measures. This is mainly taken from chs 5 and 6 of the World Bank book.
rawdata
a matrix with cols with weights and incomesatkinson_es
inequality aversion values for the Atkinson indexesgeneralised_entropy_alphas
weightpos
- column with weightsincomepos
- column with incomes
Returned is a Dict of inequality measures with:
Gini
;Atkinson
, for each value inatkinson_es
;Theil
;generalised_entropy
;Hoover
;Theil
;Palma
.
See WB chs 5 an 6, and Cobham and Sumner on the Palma.
Also in the struct are:
total_income
total_population
average_income
deciles
.
PovertyAndInequalityMeasures.make_inequality
— FunctionAs above but using the iterable table interface; see: https://github.com/queryverse/IterableTables.jl weightcol and incomecol are names of columns
PovertyAndInequalityMeasures.make_inequalityinternal
— MethodMake a dictionary of inequality measures. This is mainly taken from chs 5 and 6 of the World Bank book.
rawdata
a matrix with cols with weights and incomesatkinson_es
inequality aversion values for the Atkinson indexesgeneralised_entropy_alphas
weightpos
- column with weightsincomepos
- column with incomes
PovertyAndInequalityMeasures.make_poverty
— FunctionCreate a dictionary of poverty measures.
This is based on the World Bank's Poverty Handbook by Haughton and Khandker.
Arguments:
rawdata
- an nxm array of real nunbers; each row is an observation; one col should be a weight, another is income; positions assumed to be 1 and 2 unless weight and incomepos are suppliedline
- a poverty line, assumed same for all obs (so income is assumed to be already equivalised)foster_greer_thorndyke_alphas
- coefficients for FGT poverty measures; note that FGT(0) corresponds to headcount and FGT(1) to gap; count and gap are computed directly anyway but it's worth checking one against the other.growth
is (e.g.) 0.01 for 1% per period, and is used for 'time to exit' measure.
Output is dictionary with an entry for each measure.
The measures are:
headcount
;gap
;Foster Greer Thorndyke
, for each of the values infoster_greer_thorndyke_alphas
;Watts
;time to exit
, for the supplied growth rate;Shorrocks
;Sen
.
See World Bank, ch. 4.
PovertyAndInequalityMeasures.make_poverty
— FunctionAs above, but using the QueryVerse IterableTables interface rawdata - basically anything resembling a dataframe; see: [https://github.com/queryverse/IterableTables.jl] throws an exception if rawdata doesn't support iterabletable interface
PovertyAndInequalityMeasures.make_povertyinternal
— MethodInternal version, once we have our datatset
TODO
- better decomposable indices;
- having separate dataframe/array versions seems complicated.
Bibliography
Cobham Alex, and Sumner Andy. “Is Inequality All about the Tails?: The Palma Measure of Income Inequality.” Significance 11, no. 1 (February 19, 2014): 10–13. https://doi.org/10.1111/j.1740-9713.2014.00718.x.
Haughton, Jonathan, and Shahidur R. Khandker. ‘Handbook on Poverty and Inequality’. The World Bank, 27 March 2009. http://documents.worldbank.org/curated/en/488081468157174849/Handbook-on-poverty-and-inequality.
Preston, Ian. ‘Inequality and Income Gaps’. IFS Working Paper. Institute for Fiscal Studies, 5 December 2006. https://econpapers.repec.org/paper/ifsifsewp/06_2f25.htm.
Reed, Howard, and Graham Stark. ‘Tackling Child Poverty Delivery Plan - Forecasting Child Poverty in Scotland’. Scottish Government, 9 March 2018. http://www.gov.scot/Publications/2018/03/2911/0``.