Contents

Given data {xij}n×k{\displaystyle \{x_{ij}\}_{n\times k}}, that is, a matrix with n{\displaystyle n} rows (the blocks), k{\displaystyle k} columns (the treatments) and a single observation at the intersection of each block and treatment, calculate the rankswithin each block. If there are tied values, assign to each tied value the average of the ranks that would have been assigned without ties. Replace the data with a new matrix {rij}n×k{\displaystyle \{r_{ij}\}_{n\times k}} where the entry rij{\displaystyle r_{ij}} is the rank of xij{\displaystyle x_{ij}} within block i{\displaystyle i}.

The test statistic is given by Q=12nk(k+1)∑j=1k(r¯⋅j−k+12)2{\displaystyle Q={\frac {12n}{k(k+1)}}\sum _{j=1}^{k}\left({\bar {r}}_{\cdot j}-{\frac {k+1}{2}}\right)^{2}}. Note that the value of Q does need to be adjusted for tied values in the data.[4]

Finally, when n or k is large (i.e. n > 15 or k > 4), the probability distribution of Q can be approximated by that of a chi-squared distribution. In this case the p-value is given by P(χk−12≥Q){\displaystyle \mathbf {P} (\chi _{k-1}^{2}\geq Q)}. If n or k is small, the approximation to chi-square becomes poor and the p-value should be obtained from tables of Q specially prepared for the Friedman test. If the p-value is significant, appropriate post-hoc multiple comparisons tests would be performed.

The Skillings–Mack test is a general Friedman-type statistic that can be used in almost any block design with an arbitrary missing-data structure.

The Wittkowski test is a general Friedman-Type statistics similar to Skillings-Mack test. When the data do not contain any missing value, it gives the same result as Friedman test. But if the data contain missing values, it is both, more precise and sensitive than Skillings-Mack test.[5] An implementation of the test exists in R.[6]

Post-hoc tests were proposed by Schaich and Hamerle (1984)[7] as well as Conover (1971, 1980)[8] in order to decide which groups are significantly different from each other, based upon the mean rank differences of the groups. These procedures are detailed in Bortz, Lienert and Boehnke (2000, p. 275).[9] Eisinga, Heskes, Pelzer and Te Grotenhuis (2017)[10] provide an exact test for pairwise comparison of Friedman rank sums, implemented in R. The Eisinga c.s. exact test offers a substantial improvement over available approximate tests, especially if the number of groups (k{\displaystyle k}) is large and the number of blocks (n{\displaystyle n}) is small.

Not all statistical packages support Post-hoc analysis for Friedman's test, but user-contributed code exists that provides these facilities (for example in SPSS,[11] and in R.[12]). Also, there is a specialized package available in R containing numerous non-parametric methods for post-hoc analysis after Friedman.[13]