scikit_posthocs.posthoc_npm_test
- scikit_posthocs.posthoc_npm_test(a: list | ndarray | DataFrame, val_col: str = None, group_col: str = None, sort: bool = False) DataFrame
Calculate pairwise comparisons using Nashimoto and Wright´s all-pairs comparison procedure (NPM test) for simply ordered mean ranksums.
NPM test is basically an extension of Nemenyi´s procedure for testing increasingly ordered alternatives [1].
- Parameters:
a (array_like or pandas DataFrame object) – An array, any object exposing the array interface or a pandas DataFrame.
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.
sort (bool, optional) – If True, sort data by block and group columns.
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)
- Returns:
result – P values.
- Return type:
pandas.DataFrame
Notes
The p values are estimated from the studentized range distribution. If the medians are already increasingly ordered, than the NPM-test simplifies to the ordinary Nemenyi test
References
Examples
>>> x = np.array([[102,109,114,120,124], [110,112,123,130,145], [132,141,156,160,172]]) >>> sp.posthoc_npm_test(x)