scikit_posthocs.test_mackwolfe

scikit_posthocs.test_mackwolfe(data: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] | DataFrame, val_col: str | None = None, group_col: str | None = None, p: int | None = None, n_perm: int = 100, sort: bool = False) → tuple[float, float]

Mack-Wolfe Test for Umbrella Alternatives.

In dose-finding studies one may assume an increasing treatment effect with increasing dose level. However, the test subject may actually succumb to toxic effects at high doses, which leads to decresing treatment effects [1], [2].

The scope of the Mack-Wolfe Test is to test for umbrella alternatives for either a known or unknown point P (i.e. dose-level), where the peak (umbrella point) is present.

Parameters:
  • data (Union[List, numpy.ndarray, DataFrame]) – An array, any object exposing the array interface or a pandas DataFrame with data values.

  • val_col (str = None) – 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 = None) – 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.

  • p (int = None) – The a priori known peak as an ordinal number of the treatment group including the zero dose level, i.e. p = {0, …, k-1}. Defaults to None.

  • n_perm (int = 100) – Positive integer number of random permutations. The p value counts permuted statistics at least as large as observed and includes the observed ordering in both the numerator and denominator. Used only when p is None.

  • sort (bool = False) – If True, sort data by block and group columns.

Returns:

P value and statistic.

Return type:

tuple[float, float]

Raises:

ValueError – If fewer than two groups contain nonmissing observations, the known peak is outside the group range, or n_perm is not a positive integer when the peak is unknown.

Notes

For an unknown peak, permuted statistics within a relative tolerance of 100 times the floating-point epsilon of the observed statistic are counted as equal to it. This avoids dropping theoretical ties due to rounding.

References

Examples

>>> import scikit_posthocs as sp
>>> x = [[22, 23, 35], [60, 59, 54], [98, 78, 50], [60, 82, 59], [22, 44, 33], [23, 21, 25]]
>>> p_value, statistic = sp.test_mackwolfe(x, p=2)