scikit_posthocs.posthoc_durbin

scikit_posthocs.posthoc_durbin(a: list | ndarray | DataFrame, y_col: str | None = None, group_col: str | None = None, block_col: str | None = None, block_id_col: str | None = None, p_adjust: str | None = None, melted: bool = False, sort: bool = False) → DataFrame

Pairwise post hoc test for multiple comparisons of rank sums according to Durbin and Conover for a two-way balanced incomplete block design (BIBD). See references for additional information [1], [2].

Parameters:
  • a (array_like or pandas DataFrame object) –

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

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

    If a 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 a is a Pandas DataFrame and melted is set to True, y_col, block_col and group_col must specify columns names (string).

  • y_col (str or int) – Must be specified if a is a pandas DataFrame object. Name of the column that contains y data.

  • group_col (str or int) – Must be specified if a is a pandas DataFrame object. Name of the column that contains treatment (group) factor values.

  • block_col (str or int) – Must be specified if a is a pandas DataFrame object. Name of the column that contains blocking factor values.

  • block_id_col (str or int) – Must be specified if a is a pandas DataFrame object. Name of the column that contains identifiers of blocking factor values.

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

  • 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

Rows with missing measurements, treatment labels, or block identifiers are excluded. Counts use the remaining observations, so wholly missing blocks and treatments are ignored. The retained design must have equal block sizes, equal treatment replication, and equal pairwise concurrence.

References

Examples

>>> import numpy as np
>>> 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.posthoc_durbin(x)