G08DAF (PDF version)
G08 Chapter Contents
G08 Chapter Introduction
NAG Library Manual

NAG Library Routine Document


Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

G08DAF calculates Kendall's coefficient of concordance on k independent rankings of n objects or individuals.

2  Specification

REAL (KIND=nag_wp)  X(LDX,N), RNK(LDX,N), W, P

3  Description

Kendall's coefficient of concordance measures the degree of agreement between k comparisons of n objects, the scores in the ith comparison being denoted by
The hypothesis under test, H0, often called the null hypothesis, is that there is no agreement between the comparisons, and this is to be tested against the alternative hypothesis, H1, that there is some agreement.
The n scores for each comparison are ranked, the rank rij 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 Rj, for j=1,2,,n. Under H0, all the Rj would be approximately equal to the average rank sum kn+1/2. The total squared deviation of the Rj from this average value is therefore a measure of the departure from H0 exhibited by the data. If there were complete agreement between the comparisons, the rank sums Rj would have the values k,2k,,nk (or some permutation thereof). The total squared deviation of these values is k2n3-n/12.
Kendall's coefficient of concordance is the ratio
W = j=1 n Rj - 12 kn+1 2 112 k2 n3-n
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 kT from the denominator, where T=t3-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,kn-1W approximately follows a χn-12 distribution, so large values of W imply rejection of H0.) H0 is rejected by a test of chosen size α if p<α. If n7, tables should be used to establish the significance of W (e.g., Table R of Siegel (1956)).

4  References

Siegel S (1956) Non-parametric Statistics for the Behavioral Sciences McGraw–Hill

5  Parameters

1:     X(LDX,N) – REAL (KIND=nag_wp) arrayInput
On entry: Xij must be set to the value xij of object j in comparison i, for i=1,2,,k and j=1,2,,n.
2:     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: LDXK.
3:     K – INTEGERInput
On entry: k, the number of comparisons.
Constraint: K2.
4:     N – INTEGERInput
On entry: n, the number of objects.
Constraint: N2.
5:     RNK(LDX,N) – REAL (KIND=nag_wp) arrayWorkspace
6:     W – REAL (KIND=nag_wp)Output
On exit: the value of Kendall's coefficient of concordance, W.
7:     P – REAL (KIND=nag_wp)Output
On exit: the approximate significance, p, of W.
8:     IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to 0, -1​ or ​1. If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value -1​ or ​1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is 0. When the value -1​ or ​1 is used it is essential to test the value of IFAIL on exit.
On exit: IFAIL=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6  Error Indicators and Warnings

If on entry IFAIL=0 or -1, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Errors or warnings detected by the routine:
On entry,N<2.
On entry,LDX<K.
On entry,K1.

7  Accuracy

All computations are believed to be stable. The statistic W should be accurate enough for all practical uses.

8  Further Comments

The time taken by G08DAF is approximately proportional to the product nk.

9  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 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.

9.1  Program Text

Program Text (g08dafe.f90)

9.2  Program Data

Program Data (g08dafe.d)

9.3  Program Results

Program Results (g08dafe.r)

G08DAF (PDF version)
G08 Chapter Contents
G08 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2012