New in version 1.0.
Rank and spatial rank mobility measures
Regime mobility measure
For sequence of time periods Theta measures the extent to which rank changes for a variable measured over n locations are in the same direction within mutually exclusive and exhaustive partitions (regimes) of the n locations.
Theta is defined as the sum of the absolute sum of rank changes within the regimes over the sum of all absolute rank changes. [R4]
| Parameters: | y : array (n,k) with k>=2
regime : array (n,)
permutations : int
|
|---|
References
| [R4] | (1, 2) Rey, S.J. (2004) “Spatial dependence in the evolution of regional income distributions,” in A. Getis, J. Mur and H.Zoeller (eds). Spatial Econometrics and Spatial Statistics. Palgrave, London, pp. 194-213. |
Examples
>>> import pysal
>>> f=pysal.open("../examples/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]))
>>> regime=np.array(f.by_col['esquivel99'])
>>> np.random.seed(10)
>>> t=Theta(y,regime,999)
>>> t.theta
array([[ 0.41538462, 0.28070175, 0.61363636, 0.62222222, 0.33333333,
0.47222222]])
>>> t.pvalue_left
array([ 0.307, 0.077, 0.823, 0.552, 0.045, 0.735])
>>> t.total
array([ 130., 114., 88., 90., 90., 72.])
>>> t.max_total
512
>>>
Attributes
| ranks | array | ranks of the original y array (by columns) |
| regimes | array | the original regimes array |
| total | array (k-1,) | the total number of rank changes for each of the k periods |
| max_total | int | the theoretical maximum number of rank changes for n observations |
| theta | array (k-1,) | the theta statistic for each of the k-1 intervals |
| permutations | int | the number of permutations |
| pvalue_left | float | p-value for test that observed theta is significantly lower than its expectation under complete spatial randomness |
| pvalue_right | float | p-value for test that observed theta is significantly greater than its expectation under complete spatial randomness |
Spatial version of Kendall’s rank correlation statistic
Kendall’s Tau is based on a comparison of the number of pairs of n observations that have concordant ranks between two variables. The spatial Tau decomposes these pairs into those that are spatial neighbors and those that are not, and examines whether the rank correlation is different between the two sets. [R5]
| Parameters: | x : array (n,)
y : array (n,)
w : W
permutations : int
|
|---|
References
| [R5] | (1, 2) Rey, S.J. (2004) “Spatial dependence in the evolution of regional income distributions,” in A. Getis, J. Mur and H.Zoeller (eds). Spatial Econometrics and Spatial Statistics. Palgrave, London, pp. 194-213. |
Examples
>>> import pysal
>>> f=pysal.open("../examples/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]))
>>> regime=np.array(f.by_col['esquivel99'])
>>> w=pysal.weights.regime_weights(regime)
>>> np.random.seed(10)
>>> res=[SpatialTau(y[:,i],y[:,i+1],w,99) for i in range(6)]
>>> for r in res:
... "%8.3f %8.3f %8.3f"%(r.wnc,r.ev_wnc,r.p_rand_wnc)
...
' 44.000 52.354 0.000'
' 47.000 53.576 0.006'
' 52.000 55.747 0.031'
' 54.000 55.556 0.212'
' 53.000 53.384 0.436'
' 57.000 57.566 0.390'
>>>
Attributes
| tau | float | The classic Tau statistic |
| wn | int | The number of neighboring pairs |
| tau_w | float | Spatial Tau statistic |
| tau_nw | float | Tau for non-neighboring pairs |
| p_tau_diff | float | p-value for test of difference between tau_w and tau_nw based on asymptotic distribution (Use with caution in small samples). |
| wnc | int | number of concordant neighbor pairs |
| wdc | int | number of discordant neighbor pairs |
| ev_wnc | int | average value of concordant neighbor pairs under random spatial permuations |
| s_wnc | float | standard deviation of the number of concordant neighbor pairs under random spatial permutations. |
| p_rand_wnc | float | p-value for test of difference between wnc and its expected value under spatial random permutations |
| z_rand_wnc | z-value for test of difference between wnc and its expected | value under spatial random permutations |