inequality.gini
– Gini inequality and decomposition measures¶
The inequality.gini
module provides Gini inequality based measures
New in version 1.6.
Gini based Inequality Metrics

class
pysal.inequality.gini.
Gini
(x)[source]¶ Classic Gini coefficient in absolute deviation form
Parameters: y (array (n,1)) – attribute 
g
¶ float – Gini coefficient


class
pysal.inequality.gini.
Gini_Spatial
(x, w, permutations=99)[source]¶ Spatial Gini coefficient
Provides for computationally based inference regarding the contribution of spatial neighbor pairs to overall inequality across a set of regions. [Rey2013]
Parameters: 
g
¶ float – Gini coefficient

wg
¶ float – Neighbor inequality component (geographic inequality)

wcg
¶ float – Nonneighbor inequality component (geographic complement inequality)
float – Share of inequality in nonneighbor component

If Permuations > 0

p_sim
¶ float – pseudo pvalue for spatial gini

e_wcg
¶ float – expected value of nonneighbor inequality component (level) from permutations

s_wcg
¶ float – standard deviation nonneighbor inequality component (level) from permutations

z_wcg
¶ float – zvalue nonneighbor inequality component (level) from permutations

p_z_sim
¶ float – pseudo pvalue based on standard normal approximation of permutation based values
Examples
>>> import pysal >>> import numpy as np
Use data from the 32 Mexican States, Decade frequency 19402010
>>> f=pysal.open(pysal.examples.get_path("mexico.csv")) >>> vnames=["pcgdp%d"%dec for dec in range(1940,2010,10)] >>> y=np.transpose(np.array([f.by_col[v] for v in vnames]))
Define regime neighbors
>>> regimes=np.array(f.by_col('hanson98')) >>> w = pysal.block_weights(regimes) >>> np.random.seed(12345) >>> gs = pysal.inequality.gini.Gini_Spatial(y[:,0],w) >>> gs.p_sim 0.040000000000000001 >>> gs.wcg 4353856.0 >>> gs.e_wcg 4170356.7474747472
Thus, the amount of inequality between pairs of states that are not in the same regime (neighbors) is significantly higher than what is expected under the null of random spatial inequality.
