NAG FL Interface
g08daf (concordance_​kendall)

1 Purpose

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

2 Specification

Fortran Interface
Subroutine g08daf ( x, ldx, k, n, rnk, w, p, ifail)
Integer, Intent (In) :: ldx, k, n
Integer, Intent (Inout) :: ifail
Real (Kind=nag_wp), Intent (In) :: x(ldx,n)
Real (Kind=nag_wp), Intent (Inout) :: rnk(ldx,n)
Real (Kind=nag_wp), Intent (Out) :: w, p
C Header Interface
#include <nag.h>
void  g08daf_ (const double x[], const Integer *ldx, const Integer *k, const Integer *n, double rnk[], double *w, double *p, Integer *ifail)
The routine may be called by the names g08daf or nagf_nonpar_concordance_kendall.

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
xi1,xi2,,xin.  
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 Arguments

1: xldxn Real (Kind=nag_wp) array Input
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 Integer Input
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 Integer Input
On entry: k, the number of comparisons.
Constraint: k2.
4: n Integer Input
On entry: n, the number of objects.
Constraint: n2.
5: rnkldxn Real (Kind=nag_wp) array Workspace
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 Integer Input/Output
On entry: ifail must be set to 0, -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 -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 -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 -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:
ifail=1
On entry, n=value.
Constraint: n2.
ifail=2
On entry, ldx=value and k=value.
Constraint: ldxk.
ifail=3
On entry, k=value.
Constraint: k2.
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.
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.
ifail=-999
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

7 Accuracy

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

8 Parallelism and Performance

g08daf is not threaded in any implementation.

9 Further Comments

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

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

10.1 Program Text

Program Text (g08dafe.f90)

10.2 Program Data

Program Data (g08dafe.d)

10.3 Program Results

Program Results (g08dafe.r)