CNCRD
Calculates and test the significance of the Kendall coefficient of concordance.
Required Arguments
X — NOBS by K matrix containing the data. (Input)
Each column of X is a set of observations (which can be converted to ranks) or a set of ranks.
FUZZ — Value to be used for determining ties. (Input)
If within a column of X, the difference between two elements is less than or equal to FUZZ in absolute value, then the elements are said to be tied.
SUMS — Vector of length NOBS containing the sums of the K ranks in the corresponding row of X. (Output)
STAT — Vector of length 4 containing the output statistics. (Output)
i |
STAT(i) |
1 |
W, the coefficient of concordance |
2 |
Chi-squared statistic corresponding to W with NOBS ‑1 degrees of freedom |
3 |
Asymptotic probability of exceeding STAT(2) under the null hypothesis of independence |
4 |
Kendall S statistic. This is the sum of the squared deviations from the expected sum of the ranks |
Optional Arguments
NOBS — Number of observations per set of rankings. (Input)
Default: NOBS = size (SUMS,1).
K — Number of sets of rankings. (Input)
K must be greater than or equal to two.
Default: K = size (X,2).
LDX — Leading dimension of X exactly as specified in the dimension statement in the calling program. (Input)
Default: LDX = size (X,1).
FORTRAN 90 Interface
Generic: CALL CNCRD (X, FUZZ, SUMS, STAT [, …])
Specific: The specific interface names are S_CNCRD and D_CNCRD.
FORTRAN 77 Interface
Single: CALL CNCRD (NOBS, K, X, LDX, FUZZ, SUMS, STAT)
Double: The double precision name is DCNCRD.
Description
Routine CNCRD computes and tests the significance of the Kendall coefficient of concordance.
The coefficient of concordance is computed as follows: Within each of the k sets the n = NOBS observations are ranked. Tied ranks are used for tied observations where two observations are tied if they are within FUZZ of each other. Let xi denote the sum of the ranks for the i-th observation over the k sets. The mean of the xi is
Using this mean, compute the sums of squares of the xi about their mean as
This is the Kendall S statistic (STAT(4)). If there are tied ranks within a set i, compute the adjustment
where tj is the number of ties in the j-th group of ties, and the summation is over all tie groups for the set. Kendall’s coefficient of concordance, W, is computed as
Kendall’s coefficient of concordance is related to the Friedman one-way analysis of variance on ranks chi-squared test statistic T (see IMSL routine FRDMN as
When n or k is small, tables of the exact distribution of W exist. See Owen (1962, pages 396 ‑ 397). The probability reported in STAT(3) is asymptotic. It is only approximate when k and n are small.
Comments
1. Workspace may be explicitly provided, if desired, by use of C2CRD/DC2CRD. The reference is:
CALL C2CRD (NOBS, K, X, LDX, FUZZ, SUMS, STAT, IWK, XWK)
The additional arguments are as follows:
IWK — Work vector of length NOBS.
XWK — Work vector of length NOBS * K.
2. Informational errors
Type |
Code |
Description |
3 |
6 |
Within each of the K sets of rankings all observations are tied. STAT(1) ‑ STAT(3) cannot be computed and are set to NaN (not a number). |
3 |
7 |
The chi-squared degrees of freedom is less than 7. STAT(3) should be regarded with suspicion. |
Example
The example is taken from Kendall (1962, pages 97 ‑ 98). It involves ten observations in three sets. The resulting coefficient of concordance, 0.828, is quite large, indicating a strong relationship.
USE WRRRN_INT
USE CNCRD_INT
USE WRRRL_INT
IMPLICIT NONE
INTEGER K, LDX, NOBS
REAL FUZZ
PARAMETER (FUZZ=0.0001, K=3, LDX=10, NOBS=10)
!
REAL STAT(4), SUMS(NOBS), X(LDX,K)
CHARACTER CLABEL(2)*11, RLABEL(4)*11
!
DATA RLABEL/'W', 'Chi-squared', 'p-value', 'S'/
DATA CLABEL/'Statistic', ' '/
DATA 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/
!
CALL WRRRN ('X', X)
!
CALL CNCRD (X, FUZZ, SUMS, STAT)
!
CALL WRRRN ('SUMS', SUMS, 1, NOBS, 1, 0)
CALL WRRRL (' %/%/', STAT, RLABEL, CLABEL, FMT='(W10.6)')
END
Output
X
1 2 3
1 1.00 2.50 2.00
2 4.50 1.00 1.00
3 2.00 2.50 4.50
4 4.50 4.50 4.50
5 3.00 4.50 4.50
6 7.50 8.00 4.50
7 6.00 9.00 8.00
8 9.00 6.50 8.00
9 7.50 10.00 8.00
10 10.00 6.50 10.00
SUMS
1 2 3 4 5 6 7 8 9 10
5.50 6.50 9.00 13.50 12.00 20.00 23.00 23.50 25.50 26.50
Statistic
W 0.828
Chi-squared 22.349
p-value 0.008
S 591.000