PDF version (NAG web site
, 64bit version, 64bit version)
NAG Toolbox: nag_nonpar_concordance_kendall (g08da)
Purpose
nag_nonpar_concordance_kendall (g08da) calculates Kendall's coefficient of concordance on $k$ independent rankings of $n$ objects or individuals.
Syntax
[
w,
p,
ifail] = nag_nonpar_concordance_kendall(
x,
k, 'n',
n)
Description
Kendall's coefficient of concordance measures the degree of agreement between
$k$ comparisons of
$n$ objects, the scores in the
$i$th comparison being denoted by
The hypothesis under test,
${H}_{0}$, often called the null hypothesis, is that there is no agreement between the comparisons, and this is to be tested against the alternative hypothesis,
${H}_{1}$, that there is some agreement.
The $n$ scores for each comparison are ranked, the rank ${r}_{ij}$ denoting the rank of object $j$ in comparison $i$, and all ranks lying between $1$ and $n$. Average ranks are assigned to tied scores.
For each of the $n$ objects, the $k$ ranks are totalled, giving rank sums ${R}_{j}$, for $j=1,2,\dots ,n$. Under ${H}_{0}$, all the ${R}_{j}$ would be approximately equal to the average rank sum $k\left(n+1\right)/2$. The total squared deviation of the ${R}_{j}$ from this average value is therefore a measure of the departure from ${H}_{0}$ exhibited by the data. If there were complete agreement between the comparisons, the rank sums ${R}_{j}$ would have the values $k,2k,\dots ,nk$ (or some permutation thereof). The total squared deviation of these values is ${k}^{2}\left({n}^{3}n\right)/12$.
Kendall's coefficient of concordance is the ratio
and lies between
$0$ and
$1$, the value
$0$ indicating complete disagreement, and
$1$ indicating complete agreement.
If there are tied rankings within comparisons, $W$ is corrected by subtracting $k\sum T$ from the denominator, where $T=\sum \left({t}^{3}t\right)/12$, each $t$ being the number of occurrences of each tied rank within a comparison, and the summation of $T$ being over all comparisons containing ties.
nag_nonpar_concordance_kendall (g08da) returns the value of
$W$, and also an approximation,
$p$, of the significance of the observed
$W$. (For
$n>7,k\left(n1\right)W$ approximately follows a
${\chi}_{n1}^{2}$ distribution, so large values of
$W$ imply rejection of
${H}_{0}$.)
${H}_{0}$ is rejected by a test of chosen size
$\alpha $ if
$p<\alpha $. If
$n\le 7$, tables should be used to establish the significance of
$W$ (e.g., Table R of
Siegel (1956)).
References
Siegel S (1956) Nonparametric Statistics for the Behavioral Sciences McGraw–Hill
Parameters
Compulsory Input Parameters
 1:
$\mathrm{x}\left(\mathit{ldx},{\mathbf{n}}\right)$ – double array

ldx, the first dimension of the array, must satisfy the constraint
$\mathit{ldx}\ge {\mathbf{k}}$.
${\mathbf{x}}\left(\mathit{i},\mathit{j}\right)$ must be set to the value ${x}_{\mathit{i}\mathit{j}}$ of object $\mathit{j}$ in comparison $\mathit{i}$, for $\mathit{i}=1,2,\dots ,k$ and $\mathit{j}=1,2,\dots ,n$.
 2:
$\mathrm{k}$ – int64int32nag_int scalar

$k$, the number of comparisons.
Constraint:
${\mathbf{k}}\ge 2$.
Optional Input Parameters
 1:
$\mathrm{n}$ – int64int32nag_int scalar

Default:
the second dimension of the array
x.
$n$, the number of objects.
Constraint:
${\mathbf{n}}\ge 2$.
Output Parameters
 1:
$\mathrm{w}$ – double scalar

The value of Kendall's coefficient of concordance, $W$.
 2:
$\mathrm{p}$ – double scalar

The approximate significance, $p$, of $W$.
 3:
$\mathrm{ifail}$ – int64int32nag_int scalar
${\mathbf{ifail}}={\mathbf{0}}$ unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Errors or warnings detected by the function:
 ${\mathbf{ifail}}=1$

On entry,  ${\mathbf{n}}<2$. 
 ${\mathbf{ifail}}=2$

On entry,  $\mathit{ldx}<{\mathbf{k}}$. 
 ${\mathbf{ifail}}=3$

On entry,  ${\mathbf{k}}\le 1$. 
 ${\mathbf{ifail}}=99$
An unexpected error has been triggered by this routine. Please
contact
NAG.
 ${\mathbf{ifail}}=399$
Your licence key may have expired or may not have been installed correctly.
 ${\mathbf{ifail}}=999$
Dynamic memory allocation failed.
Accuracy
All computations are believed to be stable. The statistic $W$ should be accurate enough for all practical uses.
Further Comments
The time taken by nag_nonpar_concordance_kendall (g08da) is approximately proportional to the product $nk$.
Example
This example is taken from page 234 of
Siegel (1956). The data consists of
$10$ objects ranked on three different variables:
x,
y and
z. The computed values of Kendall's coefficient is significant at the
$1\%$ level of significance
$\left(p=0.008<0.01\right)$, indicating that the null hypothesis of there being no agreement between the three rankings
x,
y,
z may be rejected with reasonably high confidence.
Open in the MATLAB editor:
g08da_example
function g08da_example
fprintf('g08da example results\n\n');
x = [1, 4.5, 2, 4.5, 3, 7.5, 6, 9, 7.5, 10;
2.5, 1, 2.5, 4.5, 4.5, 8, 9, 6.5, 10, 6.5;
2, 1, 4.5, 4.5, 4.5, 4.5, 8, 8, 8, 10 ];
fprintf('Kendall''s coefficient of concordance\n\n');
labrow = 'Character';
rlabs = {'Comparison 1 scores';
'Comparison 2 scores';
'Comparison 3 scores'};
labcol = 'None';
clabs = {' '};
ncols = int64(80);
indent = int64(0);
[ifail] = x04cb( ...
'General', ' ', x, 'F5.1', 'Data values', labrow, ...
rlabs, labcol, clabs, ncols, indent);
k = int64(3);
[w, p, ifail] = g08da(x, k);
fprintf('\nKendall''s coefficient = %8.3f\n', w);
fprintf(' Significance = %8.3f\n', p);
g08da example results
Kendall's coefficient of concordance
Data values
Comparison 1 scores 1.0 4.5 2.0 4.5 3.0 7.5 6.0 9.0 7.5 10.0
Comparison 2 scores 2.5 1.0 2.5 4.5 4.5 8.0 9.0 6.5 10.0 6.5
Comparison 3 scores 2.0 1.0 4.5 4.5 4.5 4.5 8.0 8.0 8.0 10.0
Kendall's coefficient = 0.828
Significance = 0.008
PDF version (NAG web site
, 64bit version, 64bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015