# pysal.explore.giddy.rank.Tau_Local_Neighborhood¶

class pysal.explore.giddy.rank.Tau_Local_Neighborhood(x, y, w, permutations=0)[source]

Neighborhood set LIMA.

An extension of neighbor set LIMA. Consider local concordance relationships for a subset of states, defined as the focal state and its neighbors.

Parameters: x : array (n, ), first variable. y : array (n, ), second variable. w : W spatial weights object. permutations : int number of random spatial permutations for computationally based inference.

Notes

The equation for calculating neighborhood set LIMA statistic can be found in [Rey16] Equation (22).

Examples

>>> import pysal.lib as ps
>>> from pysal.explore.giddy.rank import Tau_Local_Neighborhood
>>> import numpy as np
>>> 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'])
>>> w = ps.weights.block_weights(regime)
>>> res = Tau_Local_Neighborhood(r[:,0],r[:,1],w,permutations=999)
>>> res.tau_lnhood
array([0.06666667, 0.6       , 0.2       , 0.8       , 0.33333333,
0.6       , 0.6       , 0.2       , 1.        , 0.06666667,
0.06666667, 0.33333333, 0.33333333, 0.2       , 1.        ,
0.33333333, 0.33333333, 0.2       , 0.6       , 0.33333333,
0.33333333, 0.06666667, 0.8       , 0.06666667, 0.2       ,
0.6       , 0.8       , 0.6       , 0.33333333, 0.8       ,
0.8       , 0.06666667])
>>> res.tau_lnhood_pvalues
array([0.106, 0.33 , 0.107, 0.535, 0.137, 0.414, 0.432, 0.169, 1.   ,
0.03 , 0.019, 0.146, 0.249, 0.1  , 0.908, 0.225, 0.311, 0.125,
0.399, 0.215, 0.334, 0.115, 0.669, 0.045, 0.11 , 0.525, 0.655,
0.466, 0.236, 0.413, 0.504, 0.038])
>>> res.sign
array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1])

Attributes: n : int number of observations. tau_local : array (n, ), local concordance (local version of the classic tau). S : array (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_lnhood : array (n, ), observed neighborhood set LIMA values. tau_lnhood_sim : array (n, permutations), neighborhood set LIMA values for permuted samples (if permutations>0). tau_lnhood_pvalues : array (n, 1), one-sided pseudo p-values for observed neighborhood set LIMA values under the null that the concordance relationships for a subset of states, defined as the focal state and its neighbors, is different from what would be expected from randomly distributed rank changes. sign : array (n, ), values indicate concordant or disconcordant: 1 concordant, -1 disconcordant
__init__(x, y, w, permutations=0)[source]

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

Methods

 __init__(x, y, w[, permutations]) Initialize self.