code: def outliers_grubbs(
      x: Union[List, np.ndarray],
      hypo: bool = False,
      alpha: float = 0.05,
  ) -> Union[np.ndarray, bool]:
      """Grubbs' Test for Outliers [1]_. This is the two-sided version
      of the test. The null hypothesis implies that there are no outliers
      in the data set.
  
      Parameters
      ----------
      x : Union[List, np.ndarray]
          An array, any object exposing the array interface, containing
          data to test for an outlier in.
  
      hypo : bool = False
          Specifies whether to return a bool value of a hypothesis test result.
          Returns ``True`` when we can reject the null hypothesis.
          Otherwise, ``False``. Available options are:
  
          - ``True``: return a hypothesis test result
          - ``False``: return a filtered array without an outlier (default)
  
      alpha : float = 0.05
          Significance level for a hypothesis test.
  
      Returns
      -------
      Union[np.ndarray, bool]
          Returns a filtered array if alternative hypothesis is true, otherwise
          an unfiltered array. Returns null hypothesis test result instead of an
          array if ``hypo`` argument is set to ``True``.
  
      Notes
      -----
      .. [1] http://www.itl.nist.gov/div898/handbook/eda/section3/eda35h1.htm
  
      Examples
      --------
      >>> x = np.array([199.31,199.53,200.19,200.82,201.92,201.95,202.18,245.57])
      >>> ph.outliers_grubbs(x)
      array([ 199.31,  199.53,  200.19,  200.82,  201.92,  201.95,  202.18])
      """
      arr = np.copy(x)
      val = np.max(np.abs(arr - np.mean(arr)))
      ind = np.argmax(np.abs(arr - np.mean(arr)))
      G = val / np.std(arr, ddof=1)
      N = len(arr)
      result = G > (N - 1) / np.sqrt(N) * np.sqrt(
          (t.ppf(1 - alpha / (2 * N), N - 2) ** 2)
          / (N - 2 + t.ppf(1 - alpha / (2 * N), N - 2) ** 2)
      )
  
      if hypo:
          return result
      else:
          if result:
              return np.delete(arr, ind)
          else:
              return arr
  
imports: from typing import Union, List
  import numpy
  from scipy.stats import t
label_desc: Use image node_id 2 for calling a global function with example usage: outliers_grubbs(x, hypo, alpha) and returns: result, np, arr