pysal.explore.giddy.rank.Tau

class pysal.explore.giddy.rank.Tau(x, y)[source]

Kendall’s Tau is based on a comparison of the number of pairs of n observations that have concordant ranks between two variables.

Parameters:
x : array

(n, ), first variable.

y : array

(n, ), second variable.

Notes

Modification of algorithm suggested by [Chr05].PySAL/giddy implementation uses a list based representation of a binary tree for the accumulation of the concordance measures. Ties are handled by this implementation (in other words, if there are ties in either x, or y, or both, the calculation returns Tau_b, if no ties classic Tau is returned.)

Examples

# from scipy example

>>> from scipy.stats import kendalltau
>>> from pysal.explore.giddy.rank import Tau
>>> x1 = [12, 2, 1, 12, 2]
>>> x2 = [1, 4, 7, 1, 0]
>>> kt = Tau(x1,x2)
>>> kt.tau
-0.47140452079103173
>>> kt.tau_p
0.24821309157521476
>>> tau, p = kendalltau(x1,x2)
>>> tau
-0.4714045207910316
>>> p
0.2827454599327748
Attributes:
tau : float

The classic Tau statistic.

tau_p : float

asymptotic p-value.

__init__(x, y)[source]

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

Methods

__init__(x, y) Initialize self.