code: def chisquare(f_obs, f_exp=None, value=0, ddof=0, return_basic=True):
      """chisquare goodness-of-fit test
  
      The null hypothesis is that the distance between the expected distribution
      and the observed frequencies is ``value``. The alternative hypothesis is
      that the distance is larger than ``value``. ``value`` is normalized in
      terms of effect size.
  
      The standard chisquare test has the null hypothesis that ``value=0``, that
      is the distributions are the same.
  
  
      Notes
      -----
      The case with value greater than zero is similar to an equivalence test,
      that the exact null hypothesis is replaced by an approximate hypothesis.
      However, TOST "reverses" null and alternative hypothesis, while here the
      alternative hypothesis is that the distance (divergence) is larger than a
      threshold.
  
      References
      ----------
      McLaren, ...
      Drost,...
  
      See Also
      --------
      powerdiscrepancy
      scipy.stats.chisquare
  
      """
  
      f_obs = np.asarray(f_obs)
      n_bins = len(f_obs)
      nobs = f_obs.sum(0)
      if f_exp is None:
          # uniform distribution
          f_exp = np.empty(n_bins, float)
          f_exp.fill(nobs / float(n_bins))
  
      f_exp = np.asarray(f_exp, float)
  
      chisq = ((f_obs - f_exp) ** 2 / f_exp).sum(0)
      if value == 0:
          pvalue = stats.chi2.sf(chisq, n_bins - 1 - ddof)
      else:
          pvalue = stats.ncx2.sf(
              chisq, n_bins - 1 - ddof, value**2 * nobs
          )
  
      if return_basic:
          return chisq, pvalue
      else:
          return chisq, pvalue
  
file_path: statsmodels/statsmodels/stats/gof.py
imports: from statsmodels.compat.python import lrange
  import numpy
  from scipy import stats
label_desc: Use image node_id 4 for calling a global function with example usage: chisquare(f_obs, f_exp, value, ddof, return_basic) and returns: chisq,  pvalue, chisq,  pvalue