scikit_posthocs.test_durbin
- scikit_posthocs.test_durbin(data: List | ndarray | 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, melted: bool = False, sort: bool = True) tuple[float, float, int]
Durbin’s test whether k groups (or treatments) in a two-way balanced incomplete block design (BIBD) have identical effects. See references for additional information [1], [2].
- Parameters:
data (Union[List, np.ndarray, DataFrame]) –
An array, any object exposing the array interface or a pandas DataFrame with data values.
If
meltedargument is set to False (default),ais 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
ais an array andmeltedis set to True, y_col, block_col and group_col must specify the indices of columns containing elements of correspondary type.If
ais a Pandas DataFrame andmeltedis 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
ais a melted pandas DataFrame object. Name of the column that contains y data.group_col (Union[str, int] = None) – Must be specified if
ais a melted pandas DataFrame object. Name of the column that contains group names.block_col (Union[str, int] = None) – Must be specified if
ais a melted pandas DataFrame object. Name of the column that contains block names.block_id_col (Union[str, int] = None) – Must be specified if
ais a melted pandas DataFrame object. Name of the column that contains identifiers of block names. In most cases, this is the same as block_col except for those cases when you have multiple instances of the same blocks.melted (bool = False) – Specifies if data are given as melted columns “y”, “blocks”, and “groups”.
sort (bool = True) – If True, sort data by block and group columns.
- Returns:
P value, statistic, and number of degrees of freedom.
- Return type:
tuple[float, float, int]
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.test_durbin(x)