scikit_posthocs.posthoc_npm_test
- scikit_posthocs.posthoc_npm_test(a: list | ndarray | DataFrame, val_col: str | None = None, group_col: str | None = None, alternative: Literal['greater', 'less'] = 'greater', nperm: int = 1000, 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.
alternative (str, optional) – Alternative hypothesis being tested. Can be either “greater” (by default) or “less”.
nperm (int, optional) – Number of permutations to perform for calculating p values.
- Returns:
result – P values.
- Return type:
pandas.DataFrame
Notes
An asymetric permutation test is conducted for calculating p values.
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)