code: def anderson(*args, dist="norm"):
      """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 :py:func:`scipy.stats.anderson`.
  
      Parameters
      ----------
      sample1, sample2,... : array_like
          Array of sample data. They may be of different lengths.
      dist : string
          The type of distribution to test against. The default is 'norm'.
          Must be one of 'norm', 'expon', 'logistic', 'gumbel'.
  
      Returns
      -------
      from_dist : boolean
          A boolean indicating if the data comes from the tested distribution (True) or not (False).
      sig_level : float
          The significance levels for the corresponding critical values, in %.
          See :py:func:`scipy.stats.anderson` for more details.
  
      Examples
      --------
      1. 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)
  
      2. Test that multiple arrays comes from the normal distribution
  
      >>> anderson(x, y, z)
      (array([ True,  True, False]), array([15., 15.,  1.]))
  
      3. Test that an array comes from the exponential distribution
  
      >>> x = np.random.exponential(size=1000)
      >>> anderson(x, dist="expon")
      (True, 15.0)
      """
      k = len(args)
      from_dist = np.zeros(k, dtype="bool")
      sig_level = np.zeros(k)
      for j in range(k):
          st, cr, sig = scipy.stats.anderson(args[j], dist=dist)
          from_dist[j] = True if (st < cr).any() else False
          sig_level[j] = sig[np.argmin(np.abs(st - cr))]
  
      if k == 1:
          from_dist = from_dist[0]
          sig_level = sig_level[0]
      return from_dist, sig_level
  
file_path: pingouin/pingouin/distribution.py
imports: import warnings
  import scipy.stats
  import numpy
  import pandas
  from collections import namedtuple
  from pingouin.utils import _flatten_list
  from pingouin.utils import remove_na, _postprocess_dataframe
label_desc: Use image node_id 4 for calling a global function with example usage: anderson() and returns: from_dist,  sig_level