hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_nonpar_concordance_kendall (g08da)

 Contents

    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example

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] = g08da(x, k, 'n', n)
[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 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.
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,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)).

References

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

Parameters

Compulsory Input Parameters

1:     xldxn – double array
ldx, the first dimension of the array, must satisfy the constraint ldxk.
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:     k int64int32nag_int scalar
k, the number of comparisons.
Constraint: k2.

Optional Input Parameters

1:     n int64int32nag_int scalar
Default: the second dimension of the array x.
n, the number of objects.
Constraint: n2.

Output Parameters

1:     w – double scalar
The value of Kendall's coefficient of concordance, W.
2:     p – double scalar
The approximate significance, p, of W.
3:     ifail int64int32nag_int scalar
ifail=0 unless the function detects an error (see Error Indicators and Warnings).

Error Indicators and Warnings

Errors or warnings detected by the function:
   ifail=1
On entry,n<2.
   ifail=2
On entry,ldx<k.
   ifail=3
On entry,k1.
   ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
   ifail=-399
Your licence key may have expired or may not have been installed correctly.
   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 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.
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');
% Table Labels
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, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015