Example:
W = 1.00,
Q = 9.00 ~ X^2,
DoF = 3,
p <= 0.029291
(this p is not reliable)
H0:
The distributions of ranks within rows are unrelated between rows.
Assumptions:
This is a distribution free test, so there are no strong assumptions.
Scale:
Ordinal within rows.
Procedure:
Start with n rows and k columns. Rank order the entries of each
row independently of the other rows. Sum the ranks for each column
(Rct) and sum the squared column totals ( Sum(Rct^2) ).
The test statistics are:
W = Sum(Rct^2) * 12 / (n^2 * k * ( k^2 - 1 ) ) -
3 * ( k + 1 ) / ( k - 1 )
Q = n * ( k - 1 ) * W
Degrees of Freedom (DoF) = ( k - 1 )
Furthermore, the mean
Spearman Rank Correlation Coeficient (Rsm)
between all the rows is:
Rsm = (n * W - 1) / ( n - 1 ) ( =
1 for the example above)
Level of Significance:
Consult a table of Q values for k = 3 and n <= 15,
or k = 4 and n <= 8. Otherwise, use the Chi-square
approximation below.
Approximation:
The probability distribution of Q under H0 can be approximated with
a X^2 distribution with ( k - 1 ) degrees of freedom if the number of
columns, k, > 4 or the number of rows n, > 15.
Remarks:
The level of significance, p <= 0.029291, given above is based on an
approximation of the Chi-square distribution. Consult a table for the exact
p value that belongs to this X^2 = 9.00 value.
Note: A X^2 approximation of Q is not reliable for n=3 and k=4.
Limitations
If there are ties, the p values are incorrect. There is a correction of Q necessary that can be found here. Thanks to Eben Goodale, University of
Massachusetts, Amherst, for pointing this out to me and finding the correction.