scikit_posthocs.test_page

scikit_posthocs.test_page(data: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] | DataFrame, y_col: str | int | None = None, group_col: str | int | None = None, block_col: str | int | None = None, block_id_col: str | int | None = None, alternative: str = 'two-sided', melted: bool = False, sort: bool = False) tuple[float, float]

Page’s ordered aligned rank sum test for a randomized complete block design against an a priori ordered alternative (group order is taken from the natural order of group_col, i.e. the order in which groups appear in the data / columns, unless sort is True) [1].

Parameters:
  • data (Union[List, np.ndarray, DataFrame]) –

    An array, any object exposing the array interface or a pandas DataFrame with data values.

    If melted is set to False (default), data is a typical matrix of block design, i.e. rows are blocks, and columns are groups given in the a priori hypothesized order. In this case, you do not need to specify col arguments.

    If data is an array and melted is set to True, y_col, block_col and group_col must specify the indices of columns containing elements of correspondary type.

    If data is a Pandas DataFrame and melted is set to True, y_col, block_col and group_col must specify columns names (string).

  • y_col (Union[str, int] = None) – Must be specified if data is a melted pandas DataFrame object. Name of the column that contains y data.

  • group_col (Union[str, int] = None) – Must be specified if data is a melted pandas DataFrame object. Name of the column that contains group names, in the a priori hypothesized order.

  • block_col (Union[str, int] = None) – Must be specified if data is a melted pandas DataFrame object. Name of the column that contains block names.

  • block_id_col (Union[str, int] = None) – Must be specified if data is a melted pandas DataFrame object. Name of the column that contains identifiers of block names.

  • alternative (str = "two-sided") – The alternative hypothesis, one of “two-sided”, “greater”, or “less”.

  • melted (bool = False) – Specifies if data are given as melted columns “y”, “blocks”, and “groups”.

  • sort (bool = False) – If True, sort data by group_col (alphabetically) instead of preserving the order in which groups appear in the data.

Returns:

P value and z statistic.

Return type:

tuple[float, float]

Notes

P values are computed from the standard normal distribution, with a continuity correction always applied (following Sachs 1997).

References

Examples

>>> import scikit_posthocs as sp
>>> x = np.array([[31,27,24],[31,28,31],[45,29,46],[21,18,48],[42,36,46],[32,17,40]])
>>> sp.test_page(x, alternative="greater")