Kendall's Tau-b

From Q
Jump to navigation Jump to search

The correlation between two variables, x and y, is:

τb=nc−nd(nt−nx)(nt−ny)

where

nc=∑i=1n∑j=1nwi(Ixi>xj,yi>yj+Ixi>xj,yi>yj),
nd=∑i=1n∑j=1nwi(Ixi<xj,yi>yj+Ixi>xj,yi<yj),
nw=∑i=1nwi,
nt=nw(nw−1)2,
nx=∑j=1t∑i=nnwiIxi=j,
ny=∑j=1r∑i=nnwiIyi=j,
wi is the Calibrated Weight for the ith of n is the number of observations,
x is a variable with t unique values, categorised in the range 1,2,..,t,
y is a variable with r unique values, categorised in the range 1,2,..,r,

The tests statistic is:

z=nc−ndv

where

v=(v0−vx−vy)/18+v1+v2,
v0=n(n−1)(2n+5),
vx=∑jtxj(txj−1)(2txj+5),
vy=∑jtyjtyj−1)(2tyj+5),
v1=∑j=1rtxj(txj−1)(txj−2),
v2=∑j=1ttyj(tyj−1)(tyj−2),
v3=(v1v2)/(9nw(nw−1)(nw−2)),
v4=∑j=1rtxj(txj−1),
v5=∑j=1ttyj(tyj−1),
v6=(v4v5)/(2nw(nw−1)),
σ^=(v0−vx−vy)/18+v3+v6,
z=nc−ndσ^,
p≈2(1−Φ(|z|))

See also

Correlations - Comparing Two Numeric Variables