code: def jarque_bera(resids, axis=0):
      r"""
      The Jarque-Bera test of normality.
  
      Parameters
      ----------
      resids : array_like
          Data to test for normality. Usually regression model residuals that
          are mean 0.
      axis : int, optional
          Axis to use if data has more than 1 dimension. Default is 0.
  
      Returns
      -------
      JB : {float, ndarray}
          The Jarque-Bera test statistic.
      JBpv : {float, ndarray}
          The pvalue of the test statistic.
      skew : {float, ndarray}
          Estimated skewness of the data.
      kurtosis : {float, ndarray}
          Estimated kurtosis of the data.
  
      Notes
      -----
      Each output returned has 1 dimension fewer than data
  
      The Jarque-Bera test statistic tests the null that the data is normally
      distributed against an alternative that the data follow some other
      distribution. The test statistic is based on two moments of the data,
      the skewness, and the kurtosis, and has an asymptotic :math:`\chi^2_2`
      distribution.
  
      The test statistic is defined
  
      .. math:: JB = n(S^2/6+(K-3)^2/24)
  
      where n is the number of data points, S is the sample skewness, and K is
      the sample kurtosis of the data.
      """
      resids = np.atleast_1d(np.asarray(resids, dtype=float))
      if resids.size < 2:
          raise ValueError("resids must contain at least 2 elements")
      # Calculate residual skewness and kurtosis
      skew = stats.skew(resids, axis=axis)
      kurtosis = 3 + stats.kurtosis(resids, axis=axis)
  
      # Calculate the Jarque-Bera test for normality
      n = resids.shape[axis]
      jb = (n / 6.0) * (skew**2 + (1 / 4.0) * (kurtosis - 3) ** 2)
      jb_pv = stats.chi2.sf(jb, 2)
  
      return jb, jb_pv, skew, kurtosis
  
file_path: statsmodels/statsmodels/stats/stattools.py
imports: from scipy import stats
  import numpy
  from statsmodels.tools.sm_exceptions import ValueWarning
label_desc: Use image node_id 3 for calling a global function with example usage: jarque_bera(resids, axis) and returns: jb,  jb_pv,  skew,  kurtosis