class_docstr: Analyses for a collection of 2x2 contingency tables.
  
  Such a collection may arise by stratifying a single 2x2 table with
  respect to another factor.  This class implements the
  'Cochran-Mantel-Haenszel' and 'Breslow-Day' procedures for
  analyzing collections of 2x2 contingency tables.
  
  Parameters
  ----------
  tables : list or ndarray
      Either a list containing several 2x2 contingency tables, or
      a 2x2xk ndarray in which each slice along the third axis is a
      2x2 contingency table.
  
  Notes
  -----
  This results are based on a sampling model in which the units are
  independent both within and between strata.
class_docstr_tok: ["Analyses","for","a","collection","of","2x2","contingency","tables",".","Such","a","collection","may","arise","by","stratifying","a","single","2x2","table","with","respect","to","another","factor",".","This","class","implements","the","'Cochran-Mantel-Haenszel","'","and","'Breslow-Day","'","procedures","for","analyzing","collections","of","2x2","contingency","tables",".","Parameters","--","--","--","--","--","tables",":","list","or","ndarray","Either","a","list","containing","several","2x2","contingency","tables",",","or","a","2x2xk","ndarray","in","which","each","slice","along","the","third","axis","is","a","2x2","contingency","table",".","Notes","--","--","-","This","results","are","based","on","a","sampling","model","in","which","the","units","are","independent","both","within","and","between","strata","."]
docstr: Test that all tables have odds ratio equal to 1.
  
  This is the 'Mantel-Haenszel' test.
  
  Parameters
  ----------
  correction : bool
      If True, use the continuity correction when calculating the
      test statistic.
  
  Returns
  -------
  Bunch
      A bunch containing the chi^2 test statistic and p-value.
docstr_tok: ["Test","that","all","tables","have","odds","ratio","equal","to","1",".","This","is","the","'Mantel-Haenszel","'","test",".","Parameters","--","--","--","--","--","correction",":","bool","If","True",",","use","the","continuity","correction","when","calculating","the","test","statistic",".","Returns","--","--","--","-","Bunch","A","bunch","containing","the","chi^2","test","statistic","and","p-value","."]
code: def test_null_odds(self, correction=False):
      """
      Test that all tables have odds ratio equal to 1.
  
      This is the 'Mantel-Haenszel' test.
  
      Parameters
      ----------
      correction : bool
          If True, use the continuity correction when calculating the
          test statistic.
  
      Returns
      -------
      Bunch
          A bunch containing the chi^2 test statistic and p-value.
      """
  
      statistic = np.sum(
          self.table[0, 0, :] - self._apb * self._apc / self._n
      )
      statistic = np.abs(statistic)
      if correction:
          statistic -= 0.5
      statistic = statistic**2
      denom = self._apb * self._apc * self._bpd * self._cpd
      denom /= self._n**2 * (self._n - 1)
      denom = np.sum(denom)
      statistic /= denom
  
      # df is always 1
      pvalue = 1 - stats.chi2.cdf(statistic, 1)
  
      b = _Bunch()
      b.statistic = statistic
      b.pvalue = pvalue
  
      return b
  
imports: import warnings
  import numpy
  import pandas
  from scipy import stats
  from statsmodels import iolib
  from statsmodels.tools import sm_exceptions
  from statsmodels.tools.decorators import cache_readonly
label_desc: Use image node_id 3 for calling the StratifiedTable obj's underlying member method code with example usage: obj.test_null_odds(correction) and returns: b