giddy.rank.Tau

class 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
xarray

(n, ), first variable.

yarray

(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.stats import kendalltau
>>> from 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
taufloat

The classic Tau statistic.

tau_pfloat

asymptotic p-value.

__init__(self, x, y)[source]

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