code: def madmedianrule(a):
      """Robust outlier detection based on the MAD-median rule.
  
      Parameters
      ----------
      a : array-like
          Input array. Must be one-dimensional.
  
      Returns
      -------
      outliers: boolean (same shape as a)
          Boolean array indicating whether each sample is an outlier (True) or
          not (False).
  
      See also
      --------
      mad
  
      Notes
      -----
      The MAD-median-rule ([1]_, [2]_) will refer to declaring :math:`X_i`
      an outlier if
  
      .. math::
  
          \\frac{\\left | X_i - M \\right |}{\\text{MAD}_{\\text{norm}}} > K,
  
      where :math:`M` is the median of :math:`X`,
      :math:`\\text{MAD}_{\\text{norm}}` the normalized median absolute deviation
      of :math:`X`, and :math:`K` is the square
      root of the .975 quantile of a :math:`X^2` distribution with one degree
      of freedom, which is roughly equal to 2.24.
  
      References
      ----------
      .. [1] Hall, P., Welsh, A.H., 1985. Limit theorems for the median
         deviation. Ann. Inst. Stat. Math. 37, 27–36.
         https://doi.org/10.1007/BF02481078
  
      .. [2] Wilcox, R. R. Introduction to Robust Estimation and Hypothesis
         Testing. (Academic Press, 2011).
  
      Examples
      --------
      >>> import pingouin as pg
      >>> a = [-1.09, 1., 0.28, -1.51, -0.58, 6.61, -2.43, -0.43]
      >>> pg.madmedianrule(a)
      array([False, False, False, False, False,  True, False, False])
      """
      a = np.asarray(a)
      assert (
          a.ndim == 1
      ), "Only 1D array / list are supported for this function."
      k = np.sqrt(scipy.stats.chi2.ppf(0.975, 1))
      return (np.fabs(a - np.median(a)) / mad(a)) > k
  
file_path: pingouin/pingouin/nonparametric.py
imports: import scipy
  import numpy
  import pandas
  from pingouin import remove_na, _check_dataframe, _postprocess_dataframe
label_desc: Use image node_id 2 for calling a global function with example usage: madmedianrule(a) and returns: unknown