# Friedman Test for Correlated Samples

This is a non-parametric version of the Repeated Measures ANOVA. The test statistic is:

${\displaystyle Q=(g-1)\sum _{i=1}^{n}w_{i}{\frac {\sum _{j=1}^{g}\sum _{i=1}^{n}w_{i}({\bar {r}}_{\cdot j}-{\bar {r}})^{2}}{\sum _{j=1}^{g}\sum _{i=1}^{n}w_{i}(r_{ij}-{\bar {r}})^{2}}}}$

where:

${\displaystyle n_{j}}$ is the number of observations in group ${\displaystyle j}$ of ${\displaystyle g}$groups,
${\displaystyle r_{ij}}$ is the rank of the ${\displaystyle i}$th observation from group ${\displaystyle j}$ where the ranking is computed within observations (e.g., if ${\displaystyle g=4}$ then ${\displaystyle r_{ij}\in {1,2,3,4}}$), where 1 is assigned to the lowest value and the average rank is used for ties,
${\displaystyle n}$ is the number of matched samples,
${\displaystyle w_{i}}$ is the Calibrated Weight,
${\displaystyle {\bar {r}}_{\cdot j}={\frac {\sum _{i=1}^{n}{w_{i}r_{ij}}}{\sum _{i=1}^{n}w_{i}}}}$,
${\displaystyle {\bar {r}}={\frac {g\sum _{i=1}^{n}w_{i}r_{ij}}{\sum _{j=1}^{g}\sum _{i=1}^{n}w_{i}}}}$,
${\displaystyle p\approx \Pr(\chi _{g-1}^{2}\geq Q)}$