class pysal.explore.inequality.theil.TheilDSim(y, partition, permutations=99)[source]

Random permutation based inference on Theil’s inequality decomposition.

Provides for computationally based inference regarding the inequality decomposition using random spatial permutations. See [RSastreGutierrez10].

y : array (n,t) or (n, )

with n taken as the observations across which inequality is calculated If y is (n,) then a scalar inequality value is determined. If y is (n,t) then an array of inequality values are determined, one value for each column in y.

partition : array (n, )

elements indicating which partition each observation belongs to. These are assumed to be exhaustive.

permutations : int

Number of random spatial permutations for computationally based inference on the decomposition.


>>> import pysal.lib
>>> from pysal.explore.inequality.theil import TheilDSim
>>> import numpy as np
>>> vnames=["pcgdp%d"%dec for dec in range(1940,2010,10)]
>>> y=np.array([f.by_col[v] for v in vnames]).T
>>> regimes=np.array(f.by_col('hanson98'))
>>> np.random.seed(10)
>>> theil_ds=TheilDSim(y,regimes,999)
>>> theil_ds.bg_pvalue
array([0.4  , 0.344, 0.001, 0.001, 0.034, 0.072, 0.032])
observed : array (n,t) or (n,)

TheilD instance for the observed data.

bg : array (permutations+1,t)

between group inequality

bg_pvalue : array (t,1)

p-value for the between group measure. Measures the percentage of the realized values that were greater than or equal to the observed bg value. Includes the observed value.

wg : array (size=permutations+1)

within group inequality Depending on the shape of y, 1 or 2-dimensional

__init__(y, partition, permutations=99)[source]

Initialize self. See help(type(self)) for accurate signature.


__init__(y, partition[, permutations]) Initialize self.