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 odds ratios are identical.
  
  This is the 'Breslow-Day' testing procedure.
  
  Parameters
  ----------
  adjust : bool
      Use the 'Tarone' adjustment to achieve the chi^2
      asymptotic distribution.
  
  Returns
  -------
  A bunch containing the following attributes:
  
  statistic : float
      The chi^2 test statistic.
  p-value : float
      The p-value for the test.
docstr_tok: ["Test","that","all","odds","ratios","are","identical",".","This","is","the","'Breslow-Day","'","testing","procedure",".","Parameters","--","--","--","--","--","adjust",":","bool","Use","the","'Tarone","'","adjustment","to","achieve","the","chi^2","asymptotic","distribution",".","Returns","--","--","--","-","A","bunch","containing","the","following","attributes",":","statistic",":","float","The","chi^2","test","statistic",".","p-value",":","float","The","p-value","for","the","test","."]
code: def test_equal_odds(self, adjust=False):
      """
      Test that all odds ratios are identical.
  
      This is the 'Breslow-Day' testing procedure.
  
      Parameters
      ----------
      adjust : bool
          Use the 'Tarone' adjustment to achieve the chi^2
          asymptotic distribution.
  
      Returns
      -------
      A bunch containing the following attributes:
  
      statistic : float
          The chi^2 test statistic.
      p-value : float
          The p-value for the test.
      """
  
      table = self.table
  
      r = self.oddsratio_pooled
      a = 1 - r
      b = r * (self._apb + self._apc) + self._dma
      c = -r * self._apb * self._apc
  
      # Expected value of first cell
      dr = np.sqrt(b**2 - 4 * a * c)
      e11 = (-b + dr) / (2 * a)
  
      # Variance of the first cell
      v11 = (
          1 / e11
          + 1 / (self._apc - e11)
          + 1 / (self._apb - e11)
          + 1 / (self._dma + e11)
      )
      v11 = 1 / v11
  
      statistic = np.sum((table[0, 0, :] - e11) ** 2 / v11)
  
      if adjust:
          adj = table[0, 0, :].sum() - e11.sum()
          adj = adj**2
          adj /= np.sum(v11)
          statistic -= adj
  
      pvalue = 1 - stats.chi2.cdf(statistic, table.shape[2] - 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 10 for calling the StratifiedTable obj's underlying member method code with example usage: obj.test_equal_odds(adjust) and returns: b