scikit_posthocs.posthoc_anderson(a: Union[list, numpy.ndarray, pandas.core.frame.DataFrame], val_col: Optional[str] = None, group_col: Optional[str] = None, midrank: bool = True, p_adjust: Optional[str] = None, sort: bool = False) pandas.core.frame.DataFrame

Anderson-Darling Pairwise Test for k-samples. Tests the null hypothesis that k-samples are drawn from the same population without having to specify the distribution function of that population 1.

  • a (array_like or pandas DataFrame object) – An array, any object exposing the array interface or a pandas DataFrame.

  • val_col (str, optional) – 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, optional) – 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.

  • midrank (bool, optional) – Type of Anderson-Darling test which is computed. If set to True (default), the midrank test applicable to continuous and discrete populations is performed. If False, the right side empirical distribution is used.

  • 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)


result – P values.

Return type




F.W. Scholz, M.A. Stephens (1987), K-Sample Anderson-Darling Tests, Journal of the American Statistical Association, Vol. 82, pp. 918-924.


>>> x = np.array([[2.9, 3.0, 2.5, 2.6, 3.2], [3.8, 2.7, 4.0, 2.4], [2.8, 3.4, 3.7, 2.2, 2.0]])
>>> sp.posthoc_anderson(x)