# pysal.explore.giddy.rank.Theta¶

class pysal.explore.giddy.rank.Theta(y, regime, permutations=999)[source]

Regime mobility measure. [Rey04]

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.

Parameters: y : array (n, k) with k>=2, successive columns of y are later moments in time (years, months, etc). regime : array (n, ), values corresponding to which regime each observation belongs to. permutations : int number of random spatial permutations to generate for computationally based inference.

Examples

>>> import pysal.lib as ps
>>> from pysal.explore.giddy.rank import Theta
>>> import numpy as np
>>> 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]))
>>> 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.
__init__(y, regime, permutations=999)[source]

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

Methods

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