scikit_posthocs.posthoc_nemenyi

scikit_posthocs.posthoc_nemenyi(a: list | ndarray | DataFrame, val_col: str = None, group_col: str = None, dist: str = 'chi', sort: bool = True) DataFrame

Post hoc pairwise test for multiple comparisons of mean rank sums (Nemenyi’s test). May be used after Kruskal-Wallis one-way analysis of variance by ranks to do pairwise comparisons [1].

Parameters:
  • a (array_like or pandas DataFrame object) – An array, any object exposing the array interface or a pandas DataFrame. Array must be two-dimensional. Second dimension may vary, i.e. groups may have different lengths.

  • val_col (str, optional) – Name of a DataFrame column that contains dependent variable values (test or response variable). Values should have a non-nominal scale. Must be specified if a is a pandas DataFrame object.

  • group_col (str, optional) – Name of a DataFrame column that contains independent variable values (grouping or predictor variable). Values should have a nominal scale (categorical). Must be specified if a is a pandas DataFrame object.

  • dist (str, optional) – Method for determining the p value. The default distribution is “chi” (chi-squared), else “tukey” (studentized range).

  • sort (bool, optional) – Specifies whether to sort DataFrame by group_col or not. Recommended unless you sort your data manually.

Returns:

result – P values.

Return type:

pandas.DataFrame

Notes

A tie correction will be employed according to Glantz (2012).

References

Examples

>>> x = [[1,2,3,5,1], [12,31,54, np.nan], [10,12,6,74,11]]
>>> sp.posthoc_nemenyi(x)