# pysal.explore.inequality.theil.TheilD¶

class pysal.explore.inequality.theil.TheilD(y, partition)[source]

Decomposition of Theil’s T based on partitioning of observations into exhaustive and mutually exclusive groups

Parameters: 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.

Examples

>>> import pysal.lib
>>> from pysal.explore.inequality.theil import TheilD
>>> import numpy as np
>>> f=pysal.lib.io.open(pysal.lib.examples.get_path("mexico.csv"))
>>> 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'))
>>> theil_d=TheilD(y,regimes)
>>> theil_d.bg
array([0.0345889 , 0.02816853, 0.05260921, 0.05931219, 0.03205257,
0.02963731, 0.03635872])
>>> theil_d.wg
array([0.17435454, 0.12405598, 0.0521202 , 0.04263506, 0.06354856,
0.07547525, 0.0702496 ])

Attributes: T : array (n,t) or (n,) global inequality T bg : array (n,t) or (n,) between group inequality wg : array (n,t) or (n,) within group inequality
__init__(y, partition)[source]

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

Methods

 __init__(y, partition) Initialize self.