pingouin.friedman

pingouin.friedman(data=None, dv=None, within=None, subject=None)[source]

Friedman test for repeated measurements.

Parameters
datapandas.DataFrame

DataFrame

dvstring

Name of column containing the dependent variable.

withinstring

Name of column containing the within-subject factor.

subjectstring

Name of column containing the subject identifier.

Returns
statspandas.DataFrame
  • 'Q': The Friedman Q statistic, corrected for ties

  • 'p-unc': Uncorrected p-value

  • 'dof': degrees of freedom

Notes

The Friedman test is used for one-way repeated measures ANOVA by ranks.

Data are expected to be in long-format.

Note that if the dataset contains one or more other within subject factors, an automatic collapsing to the mean is applied on the dependent variable (same behavior as the ezANOVA R package). As such, results can differ from those of JASP. If you can, always double-check the results.

Due to the assumption that the test statistic has a chi squared distribution, the p-value is only reliable for n > 10 and more than 6 repeated measurements.

NaN values are automatically removed.

Examples

Compute the Friedman test for repeated measurements.

>>> from pingouin import friedman, read_dataset
>>> df = read_dataset('rm_anova')
>>> friedman(data=df, dv='DesireToKill', within='Disgustingness',
...          subject='Subject')
                  Source  ddof1         Q     p-unc
Friedman  Disgustingness      1  9.227848  0.002384