giddy.rank.Tau_Regional

class giddy.rank.Tau_Regional(x, y, regime, permutations=0)[source]

Inter and intraregional decomposition of the classic Tau.

Parameters
xarray

(n, ), first variable.

yarray

(n, ), second variable.

regimesarray

(n, ), ids of which regime an observation belongs to.

permutationsint

number of random spatial permutations for computationally based inference.

Notes

The equation for calculating inter and intraregional Tau statistic can be found in [Rey16] Equation (27).

Examples

>>> import libpysal as ps
>>> import numpy as np
>>> from giddy.rank import Tau_Regional
>>> np.random.seed(10)
>>> f = ps.io.open(ps.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]))
>>> r = y / y.mean(axis=0)
>>> regime = np.array(f.by_col['esquivel99'])
>>> res = Tau_Regional(y[:,0],y[:,-1],regime,permutations=999)
>>> res.tau_reg
array([[1.        , 0.25      , 0.5       , 0.6       , 0.83333333,
        0.6       , 1.        ],
       [0.25      , 0.33333333, 0.5       , 0.3       , 0.91666667,
        0.4       , 0.75      ],
       [0.5       , 0.5       , 0.6       , 0.4       , 0.38888889,
        0.53333333, 0.83333333],
       [0.6       , 0.3       , 0.4       , 0.2       , 0.4       ,
        0.28      , 0.8       ],
       [0.83333333, 0.91666667, 0.38888889, 0.4       , 0.6       ,
        0.73333333, 1.        ],
       [0.6       , 0.4       , 0.53333333, 0.28      , 0.73333333,
        0.8       , 0.8       ],
       [1.        , 0.75      , 0.83333333, 0.8       , 1.        ,
        0.8       , 0.33333333]])
>>> res.tau_reg_pvalues
array([[0.782, 0.227, 0.464, 0.638, 0.294, 0.627, 0.201],
       [0.227, 0.352, 0.391, 0.14 , 0.048, 0.252, 0.327],
       [0.464, 0.391, 0.587, 0.198, 0.107, 0.423, 0.124],
       [0.638, 0.14 , 0.198, 0.141, 0.184, 0.089, 0.217],
       [0.294, 0.048, 0.107, 0.184, 0.583, 0.25 , 0.005],
       [0.627, 0.252, 0.423, 0.089, 0.25 , 0.38 , 0.227],
       [0.201, 0.327, 0.124, 0.217, 0.005, 0.227, 0.322]])
Attributes
nint

number of observations.

Sarray

(n ,n), concordance matrix, s_{i,j}=1 if observation i and j are concordant, s_{i, j}=-1 if observation i and j are discordant, and s_{i,j}=0 otherwise.

tau_regarray

(k, k), observed concordance matrix with diagonal elements measuring concordance between units within a regime and the off-diagonal elements denoting concordance between observations from a specific pair of different regimes.

tau_reg_simarray

(permutations, k, k), concordance matrices for permuted samples (if permutations>0).

tau_reg_pvaluesarray

(k, k), one-sided pseudo p-values for observed concordance matrix under the null that income mobility were random in its spatial distribution.

__init__(self, x, y, regime, permutations=0)[source]

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

Methods

__init__(self, x, y, regime[, permutations])

Initialize self.