## Freedman's Test Demo

Friedman's test applies a non-parametric approach that provides a statistical measure for difference between groups. Consider the following data in wave1:

 Group1 Group2 Group3 Group4 Block1 7.34 10.6 9.48 9.15 Block2 7 9.5 9 6.17 Block3 6.5 12.81 10.7 11.35 Block4 4.73 12.55 13.24 5.7 Block5 6.51 10.1 15.7 14.22

To run Friedman's test on this data, execute the command:

`StatsFriedmanTest/T=1/Q /RW wave1`

The results are stored in the wave M_FriedmanRanks and Friedman Test table:

 Rows Cols Stat. Crit. appox. Chi I_D_Ff I_D_Crit. Conclusion 5 4 9.24 7.825 7.81473 4.8125 3.49029 0

and in the wave M_FriedmanRanks where each element represents the rank of the corresponding datum:

 1 4 3 2 2 4 3 1 1 4 2 3 1 3 4 2 1 2 4 3

In this case Friedman's statistic (9.24) exceeds the critical value (7.825) so the null hypothesis H0 (no difference between the groups) must be rejected. The Chi-square approximation and the Iman and Davenport Ff as well as the critical values all agree with this conclusion.

Although the operation does not provide the associated P-value, you can compute it using the command:

`Print 1-statsFriedmanCDF(9.24,4,5,0,1)`

The resulting P-value is: 0.0166709.

Applying Friedman's test to a second data set of the same dimensions in wave2:

 Group1 Group2 Group3 Group4 Block1 5.13 6.25 7.28 14.17 Block2 6.18 12.93 7.52 12.08 Block3 12.93 9.39 8.81 10.88 Block4 10.46 8.88 13.08 4.4 Block5 9.21 13.64 14.37 10.69

`StatsFriedmanTest/T=1/Q /RW wave2`

The results are found in the Friedman Test table:

 Rows Cols Stat. Crit. appox. Chi I_D_Ff I_D_Crit. Conclusion 5 4 1.08 7.825 7.81473 0.232759 3.49029 1

and in the wave M_FriedmanRanks:

 1 2 3 4 1 4 2 3 4 2 1 3 3 2 4 1 1 3 4 2

The statistic (1.08) is smaller than the critical value (7.825) and so H0 can't be rejected. Comparing the two distribution of ranks it is evident that in this case they appear to be distributed more randomly which is consistent with the test's conclusion.

You can compute associated P-value using the command:

`Print 1-statsFriedmanCDF(1.08,4,5,0,1)`
`P = 0.85656.`