pingouin.friedman

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

Friedman test for repeated measurements.

Parameters
dvstring

Name of column containing the dependant variable.

withinstring

Name of column containing the within-subject factor.

subjectstring

Name of column containing the subject identifier.

datapandas DataFrame

DataFrame

export_filenamestring

Filename (without extension) for the output file. If None, do not export the table. By default, the file will be created in the current python console directory. To change that, specify the filename with full path.

Returns
statsDataFrame

Test summary

'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 dependant 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(dv='DesireToKill', within='Disgustingness',
...          subject='Subject', data=df)
                  Source  ddof1      Q     p-unc
Friedman  Disgustingness      1  9.228  0.002384