pingouin.anderson#
- pingouin.anderson(*args, dist='norm')[source]#
Anderson-Darling test of distribution.
The Anderson-Darling test tests the null hypothesis that a sample is drawn from a population that follows a particular distribution. For the Anderson-Darling test, the critical values depend on which distribution is being tested against.
This function is a wrapper around
scipy.stats.anderson()
.- Parameters:
- sample1, sample2,…array_like
Array of sample data. They may be of different lengths.
- diststring
The type of distribution to test against. The default is ‘norm’. Must be one of ‘norm’, ‘expon’, ‘logistic’, ‘gumbel’.
- Returns:
- from_distboolean
A boolean indicating if the data comes from the tested distribution (True) or not (False).
- sig_levelfloat
The significance levels for the corresponding critical values, in %. See
scipy.stats.anderson()
for more details.
Examples
Test that an array comes from a normal distribution
>>> from pingouin import anderson >>> import numpy as np >>> np.random.seed(42) >>> x = np.random.normal(size=100) >>> y = np.random.normal(size=10000) >>> z = np.random.random(1000) >>> anderson(x) (True, 15.0)
Test that multiple arrays comes from the normal distribution
>>> anderson(x, y, z) (array([ True, True, False]), array([15., 15., 1.]))
Test that an array comes from the exponential distribution
>>> x = np.random.exponential(size=1000) >>> anderson(x, dist="expon") (True, 15.0)