# Friedman test

Example:
/dev/null> /dev/null> /dev/null> W = , Q = ~ X^2, DoF = , p <=

Ratings --> ()

Judges ()
Row and column names must be distinct and should start with an alphabetic character. Do not enter total scores

Characteristics:
The Friedman test is frequently called a two-way analysis on ranks. It is at the same time a generalization of the \\$3)++p;}END{printf("%d",p);}'>&negative=>Sign-Test and the >Spearman Rank Correlation Test. The Friedman test models the ratingsof n (rows) judges on k (columns) "treatments". A popular example are wine tastings, where each judge rates a colection of wines independently of the other judges. Under H0, the ratings of the judges are not related (e.g., they cannot distinguish the wines).
The test parameter W is called Kendall's coefficient of concordance and is related to the mean Rank correlation coefficient. If the test parameter Q is high (i.e., statistically significant) then the columns are different and the rows are correlated.
Rank ordering is done within rows and each row is used independent of the others. That is, only the relative rank-orders within each row are used. All entries in a single row can be multiplied by an arbitrary number without affecting the outcome of the test.
For two columns the Friedman test reduces to the \\$3)++p;}END{printf("%d",p);}'>&negative=>Sign-Test. For two rows, this test reduces to the >Spearman Rank Correlation Test.

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 ) ( = 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 <= , 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 = value.
Note: A X^2 approximation of Q is not reliable for n="\\$1" and k="\\$2".");}'>

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.