<s>
In	O
statistics	O
,	O
the	O
Kendall	B-General_Concept
rank	I-General_Concept
correlation	I-General_Concept
coefficient	I-General_Concept
,	O
commonly	O
referred	O
to	O
as	O
Kendall	B-General_Concept
's	I-General_Concept
τ	I-General_Concept
coefficient	O
(	O
after	O
the	O
Greek	O
letter	O
τ	O
,	O
tau	O
)	O
,	O
is	O
a	O
statistic	O
used	O
to	O
measure	O
the	O
ordinal	O
association	O
between	O
two	O
measured	O
quantities	O
.	O
</s>
<s>
A	O
τ	O
test	O
is	O
a	O
non-parametric	B-General_Concept
hypothesis	O
test	O
for	O
statistical	O
dependence	O
based	O
on	O
the	O
τ	O
coefficient	O
.	O
</s>
<s>
Intuitively	O
,	O
the	O
Kendall	B-General_Concept
correlation	I-General_Concept
between	O
two	O
variables	O
will	O
be	O
high	O
when	O
observations	O
have	O
a	O
similar	O
(	O
or	O
identical	O
for	O
a	O
correlation	O
of	O
1	O
)	O
rank	O
(	O
i.e.	O
</s>
<s>
Any	O
pair	O
of	O
observations	O
and	O
,	O
where	O
,	O
are	O
said	O
to	O
be	O
concordant	B-General_Concept
if	O
the	O
sort	O
order	O
of	O
and	O
agrees	O
:	O
that	O
is	O
,	O
if	O
either	O
both	O
and	O
holds	O
or	O
both	O
and	O
;	O
otherwise	O
they	O
are	O
said	O
to	O
be	O
discordant	O
.	O
</s>
<s>
The	O
Kendall	O
rank	O
coefficient	O
is	O
often	O
used	O
as	O
a	O
test	B-General_Concept
statistic	I-General_Concept
in	O
a	O
statistical	O
hypothesis	O
test	O
to	O
establish	O
whether	O
two	O
variables	O
may	O
be	O
regarded	O
as	O
statistically	O
dependent	O
.	O
</s>
<s>
This	O
test	O
is	O
non-parametric	B-General_Concept
,	O
as	O
it	O
does	O
not	O
rely	O
on	O
any	O
assumptions	O
on	O
the	O
distributions	O
of	O
X	O
or	O
Y	O
or	O
the	O
distribution	O
of	O
(	O
X	O
,	O
Y	O
)	O
.	O
</s>
<s>
Under	O
the	O
null	B-General_Concept
hypothesis	I-General_Concept
of	O
independence	O
of	O
X	O
and	O
Y	O
,	O
the	O
sampling	B-General_Concept
distribution	I-General_Concept
of	O
τ	O
has	O
an	O
expected	O
value	O
of	O
zero	O
.	O
</s>
<s>
A	O
pair	O
is	O
said	O
to	O
be	O
tied	O
if	O
or	O
;	O
a	O
tied	O
pair	O
is	O
neither	O
concordant	B-General_Concept
nor	O
discordant	O
.	O
</s>
<s>
The	O
Tau-a	B-General_Concept
statistic	O
tests	O
the	O
strength	O
of	O
association	O
of	O
the	O
cross	B-Application
tabulations	I-Application
.	O
</s>
<s>
Tau-a	B-General_Concept
will	O
not	O
make	O
any	O
adjustment	O
for	O
ties	O
.	O
</s>
<s>
The	O
Tau-b	B-General_Concept
statistic	O
,	O
unlike	O
Tau-a	B-General_Concept
,	O
makes	O
adjustments	O
for	O
ties	O
.	O
</s>
<s>
Values	O
of	O
Tau-b	B-General_Concept
range	O
from	O
−1	O
(	O
100%	O
negative	O
association	O
,	O
or	O
perfect	O
inversion	O
)	O
to	O
+1	O
(	O
100%	O
positive	O
association	O
,	O
or	O
perfect	O
agreement	O
)	O
.	O
</s>
<s>
A	O
simple	O
algorithm	O
developed	O
in	O
BASIC	O
computes	O
Tau-b	B-General_Concept
coefficient	O
using	O
an	O
alternative	O
formula	O
.	O
</s>
<s>
SPSS	O
,	O
use	O
alternative	O
formulas	O
for	O
computational	O
efficiency	O
,	O
with	O
double	O
the	O
'	O
usual	O
 '	O
number	O
of	O
concordant	B-General_Concept
and	O
discordant	B-General_Concept
pairs	I-General_Concept
.	O
</s>
<s>
Tau-c	B-General_Concept
(	O
also	O
called	O
Stuart-Kendall	O
Tau-c	B-General_Concept
)	O
is	O
more	O
suitable	O
than	O
Tau-b	B-General_Concept
for	O
the	O
analysis	O
of	O
data	O
based	O
on	O
non-square	O
(	O
i.e.	O
</s>
<s>
rectangular	O
)	O
contingency	B-Application
tables	I-Application
.	O
</s>
<s>
So	O
use	O
Tau-b	B-General_Concept
if	O
the	O
underlying	O
scale	O
of	O
both	O
variables	O
has	O
the	O
same	O
number	O
of	O
possible	O
values	O
(	O
before	O
ranking	O
)	O
and	O
Tau-c	B-General_Concept
if	O
they	O
differ	O
.	O
</s>
<s>
If	O
the	O
p-value	O
is	O
below	O
a	O
given	O
significance	O
level	O
,	O
one	O
rejects	O
the	O
null	B-General_Concept
hypothesis	I-General_Concept
(	O
at	O
that	O
significance	O
level	O
)	O
that	O
the	O
quantities	O
are	O
statistically	O
independent	O
.	O
</s>
<s>
A	O
more	O
sophisticated	O
algorithm	O
built	O
upon	O
the	O
Merge	B-Algorithm
Sort	I-Algorithm
algorithm	O
can	O
be	O
used	O
to	O
compute	O
the	O
numerator	O
in	O
time	O
.	O
</s>
<s>
With	O
this	O
initial	O
ordering	O
,	O
is	O
not	O
sorted	O
,	O
and	O
the	O
core	O
of	O
the	O
algorithm	O
consists	O
of	O
computing	O
how	O
many	O
steps	O
a	O
Bubble	B-Algorithm
Sort	I-Algorithm
would	O
take	O
to	O
sort	O
this	O
initial	O
.	O
</s>
<s>
An	O
enhanced	O
Merge	B-Algorithm
Sort	I-Algorithm
algorithm	O
,	O
with	O
complexity	O
,	O
can	O
be	O
applied	O
to	O
compute	O
the	O
number	O
of	O
swaps	O
,	O
,	O
that	O
would	O
be	O
required	O
by	O
a	O
Bubble	B-Algorithm
Sort	I-Algorithm
to	O
sort	O
.	O
</s>
<s>
A	O
Merge	B-Algorithm
Sort	I-Algorithm
partitions	O
the	O
data	O
to	O
be	O
sorted	O
,	O
into	O
two	O
roughly	O
equal	O
halves	O
,	O
and	O
,	O
then	O
sorts	O
each	O
half	O
recursive	O
,	O
and	O
then	O
merges	O
the	O
two	O
sorted	O
halves	O
into	O
a	O
fully	O
sorted	O
vector	O
.	O
</s>
<s>
The	O
number	O
of	O
Bubble	B-Algorithm
Sort	I-Algorithm
swaps	O
is	O
equal	O
to	O
:	O
</s>
<s>
where	O
and	O
are	O
the	O
sorted	O
versions	O
of	O
and	O
,	O
and	O
characterizes	O
the	O
Bubble	B-Algorithm
Sort	I-Algorithm
swap-equivalent	O
for	O
a	O
merge	O
operation	O
.	O
</s>
<s>
R	B-Language
's	O
statistics	O
base-package	O
implements	O
the	O
test	O
in	O
its	O
"	O
stats	O
"	O
package	O
(	O
also	O
cor( x	O
,	O
y	O
,	O
method	O
=	O
"	O
kendall	O
"	O
)	O
will	O
work	O
,	O
but	O
the	O
latter	O
does	O
not	O
return	O
the	O
p-value	O
)	O
.	O
</s>
