scikit_posthocs.posthoc_wilcoxon

scikit_posthocs.posthoc_wilcoxon(a, val_col=None, group_col=None, zero_method='wilcox', correction=False, p_adjust=None, sort=False)

Pairwise comparisons with Wilcoxon signed-rank test. It is a non-parametric version of the paired T-test for use with non-parametric ANOVA.

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.
  • 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.
  • zero_method (string, {"pratt", "wilcox", "zsplit"}, optional) – “pratt”: Pratt treatment, includes zero-differences in the ranking process (more conservative) “wilcox”: Wilcox treatment, discards all zero-differences “zsplit”: Zero rank split, just like Pratt, but spliting the zero rank between positive and negative ones
  • correction (bool, optional) – If True, apply continuity correction by adjusting the Wilcoxon rank statistic by 0.5 towards the mean value when computing the z-statistic. Default is False.
  • p_adjust (str, optional) – Method for adjusting p values. See statsmodels.sandbox.stats.multicomp for details. Available methods are: ‘bonferroni’ : one-step correction ‘sidak’ : one-step correction ‘holm-sidak’ : step-down method using Sidak adjustments ‘holm’ : step-down method using Bonferroni adjustments ‘simes-hochberg’ : step-up method (independent) ‘hommel’ : closed method based on Simes tests (non-negative) ‘fdr_bh’ : Benjamini/Hochberg (non-negative) ‘fdr_by’ : Benjamini/Yekutieli (negative) ‘fdr_tsbh’ : two stage fdr correction (non-negative) ‘fdr_tsbky’ : two stage fdr correction (non-negative)
  • sort (bool, optional) – Specifies whether to sort DataFrame by group_col and val_col or not. Default is False.
Returns:

result – P values.

Return type:

pandas DataFrame

Notes

Refer to scipy.stats.wilcoxon reference page for further details.

Examples

>>> x = [[1,2,3,4,5], [35,31,75,40,21], [10,6,9,6,1]]
>>> sp.posthoc_wilcoxon(x)