scikit_posthocs.test_durbin
- scikit_posthocs.test_durbin(data: List | ndarray | DataFrame, y_col: str | int = None, block_col: str | int = None, group_col: str | int = 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
melted
argument 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 andmelted
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 andmelted
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
a
is a pandas DataFrame object. Name of the column that contains y data.block_col (Union[str, int] = None) – Must be specified if
a
is a pandas DataFrame object. Name of the column that contains block names.group_col (Union[str, int] = None) – Must be specified if
a
is a pandas DataFrame object. Name of the column that contains group names.melted (bool = False) – Specifies if data are given as melted columns “y”, “blocks”, and “groups”.
sort (bool = False) – 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]
References
Examples
>>> 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)