# pingouin.kruskal

pingouin.kruskal(dv=None, between=None, data=None, detailed=False, export_filename=None)[source]

Kruskal-Wallis H-test for independent samples.

Parameters
dvstring

Name of column containing the dependant variable.

betweenstring

Name of column containing the between factor.

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

'H' : The Kruskal-Wallis H statistic, corrected for ties
'p-unc' : Uncorrected p-value
'dof' : degrees of freedom


Notes

The Kruskal-Wallis H-test tests the null hypothesis that the population median of all of the groups are equal. It is a non-parametric version of ANOVA. The test works on 2 or more independent samples, which may have different sizes.

Due to the assumption that H has a chi square distribution, the number of samples in each group must not be too small. A typical rule is that each sample must have at least 5 measurements.

NaN values are automatically removed.

Examples

Compute the Kruskal-Wallis H-test for independent samples.

>>> from pingouin import kruskal, read_dataset
>>> df = read_dataset('anova')
>>> kruskal(dv='Pain threshold', between='Hair color', data=df)
Source  ddof1       H     p-unc
Kruskal  Hair color      3  10.589  0.014172