The routine may be called by the names g08daf or nagf_nonpar_concordance_kendall.
3Description
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
$${x}_{i1},{x}_{i2},\dots ,{x}_{in}\text{.}$$
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(n+1)/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}({n}^{3}-n)/12$.
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 ({t}^{3}-t)/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.
g08daf returns the value of $W$, and also an approximation, $p$, of the significance of the observed $W$. (For $n>7,k(n-1)W$ approximately follows a ${\chi}_{n-1}^{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)).
4References
Siegel S (1956) Non-parametric Statistics for the Behavioral Sciences McGraw–Hill
5Arguments
1: $\mathbf{x}({\mathbf{ldx}},{\mathbf{n}})$ – Real (Kind=nag_wp) arrayInput
On entry: ${\mathbf{x}}(\mathit{i},\mathit{j})$ 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: $\mathbf{ldx}$ – IntegerInput
On entry: the first dimension of the arrays x and rnk as declared in the (sub)program from which g08daf is called.
Constraint:
${\mathbf{ldx}}\ge {\mathbf{k}}$.
3: $\mathbf{k}$ – IntegerInput
On entry: $k$, the number of comparisons.
Constraint:
${\mathbf{k}}\ge 2$.
4: $\mathbf{n}$ – IntegerInput
On entry: $n$, the number of objects.
Constraint:
${\mathbf{n}}\ge 2$.
5: $\mathbf{rnk}({\mathbf{ldx}},{\mathbf{n}})$ – Real (Kind=nag_wp) arrayWorkspace
6: $\mathbf{w}$ – Real (Kind=nag_wp)Output
On exit: the value of Kendall's coefficient of concordance, $W$.
7: $\mathbf{p}$ – Real (Kind=nag_wp)Output
On exit: the approximate significance, $p$, of $W$.
8: $\mathbf{ifail}$ – IntegerInput/Output
On entry: ifail must be set to $0$, $\mathrm{-1}$ or $1$ to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of $0$ causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of $\mathrm{-1}$ means that an error message is printed while a value of $1$ means that it is not.
If halting is not appropriate, the value $\mathrm{-1}$ or $1$ is recommended. If message printing is undesirable, then the value $1$ is recommended. Otherwise, the value $0$ is recommended. When the value $-\mathbf{1}$ or $\mathbf{1}$ is used it is essential to test the value of ifail on exit.
On exit: ${\mathbf{ifail}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see Section 6).
6Error Indicators and Warnings
If on entry ${\mathbf{ifail}}=0$ or $\mathrm{-1}$, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
${\mathbf{ifail}}=1$
On entry, ${\mathbf{n}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{n}}\ge 2$.
${\mathbf{ifail}}=2$
On entry, ${\mathbf{ldx}}=\u27e8\mathit{\text{value}}\u27e9$ and ${\mathbf{k}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{ldx}}\ge {\mathbf{k}}$.
${\mathbf{ifail}}=3$
On entry, ${\mathbf{k}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{k}}\ge 2$.
${\mathbf{ifail}}=-99$
An unexpected error has been triggered by this routine. Please
contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-399$
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.
7Accuracy
All computations are believed to be stable. The statistic $W$ should be accurate enough for all practical uses.
8Parallelism and Performance
Background information to multithreading can be found in the Multithreading documentation.
g08daf is not threaded in any implementation.
9Further Comments
The time taken by g08daf is approximately proportional to the product $nk$.
10Example
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 $(p=0.008<0.01)$, indicating that the null hypothesis of there being no agreement between the three rankings X, Y, Z may be rejected with reasonably high confidence.