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) >>> print("%.5f" % kt.tau) -0.47140 >>> print("%.5f" % kt.tau_p) 0.24821 >>> tau, p = kendalltau(x1,x2) >>> print("%.5f" % tau) -0.47140 >>> print("%.5f" % p) 0.28275
- Attributes:
- taufloat
The classic Tau statistic.
- tau_pfloat
asymptotic p-value.
Methods
__init__
(x, y)