giddy.rank.Tau_Local

class giddy.rank.Tau_Local(x, y)[source]

Local version of the classic Tau.

Decomposition of the classic Tau into local components.

Parameters:
xarray

(n, ), first variable.

yarray

(n, ), second variable.

Notes

The equation for calculating local concordance statistic can be found in [Rey16] Equation (9).

Examples

>>> import libpysal as ps
>>> import numpy as np
>>> from giddy.rank import Tau_Local,Tau
>>> np.random.seed(10)
>>> 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]))
>>> r = y / y.mean(axis=0)
>>> tau_local = Tau_Local(r[:,0],r[:,1])
>>> tau_local.tau_local
array([-0.03225806,  0.93548387,  0.80645161,  0.74193548,  0.93548387,
        0.74193548,  0.67741935,  0.41935484,  1.        ,  0.5483871 ,
        0.74193548,  0.93548387,  0.67741935,  0.74193548,  0.80645161,
        0.74193548,  0.5483871 ,  0.67741935,  0.74193548,  0.74193548,
        0.5483871 , -0.16129032,  0.93548387,  0.61290323,  0.67741935,
        0.48387097,  0.93548387,  0.61290323,  0.74193548,  0.41935484,
        0.61290323,  0.61290323])
>>> tau_local.tau
0.6612903225806451
>>> tau_classic = Tau(r[:,0],r[:,1])
>>> tau_classic.tau
0.6612903225806451
Attributes:
nint

number of observations.

taufloat

The classic Tau statistic.

tau_localarray

(n, ), local concordance (local version of the classic tau).

Sarray

(n ,n), concordance matrix, s_{i,j}=1 if observation i and j are concordant, s_{i,j}=-1 if observation i and j are discordant, and s_{i,j}=0 otherwise.

__init__(x, y)[source]

Methods

__init__(x, y)