class_docstr: A two-way contingency table.
  
  Parameters
  ----------
  table : array_like
      A contingency table.
  shift_zeros : bool
      If True and any cell count is zero, add 0.5 to all values
      in the table.
  
  Attributes
  ----------
  table_orig : array_like
      The original table is cached as `table_orig`.
  
  See Also
  --------
  statsmodels.graphics.mosaicplot.mosaic
  scipy.stats.chi2_contingency
  
  Notes
  -----
  The inference procedures used here are all based on a sampling
  model in which the units are independent and identically
  distributed, with each unit being classified with respect to two
  categorical variables.
  
  References
  ----------
  Definitions of residuals:
      https://onlinecourses.science.psu.edu/stat504/node/86
class_docstr_tok: ["A","two-way","contingency","table",".","Parameters","--","--","--","--","--","table",":","array_like","A","contingency","table",".","shift_zeros",":","bool","If","True","and","any","cell","count","is","zero",",","add","0.5","to","all","values","in","the","table",".","Attributes","--","--","--","--","--","table_orig",":","array_like","The","original","table","is","cached","as","`","table_orig","`",".","See","Also","--","--","--","--","statsmodels.graphics.mosaicplot.mosaic","scipy.stats.chi2_contingency","Notes","--","--","-","The","inference","procedures","used","here","are","all","based","on","a","sampling","model","in","which","the","units","are","independent","and","identically","distributed",",","with","each","unit","being","classified","with","respect","to","two","categorical","variables",".","References","--","--","--","--","--","Definitions","of","residuals",":","https",":","\/\/onlinecourses.science.psu.edu\/stat504\/node\/86"]
docstr: Assess independence for nominal factors.
  
  Assessment of independence between rows and columns using
  chi^2 testing.  The rows and columns are treated as nominal
  (unordered) categorical variables.
  
  Returns
  -------
  A bunch containing the following attributes:
  
  statistic : float
      The chi^2 test statistic.
  df : int
      The degrees of freedom of the reference distribution
  pvalue : float
      The p-value for the test.
docstr_tok: ["Assess","independence","for","nominal","factors",".","Assessment","of","independence","between","rows","and","columns","using","chi^2","testing",".","The","rows","and","columns","are","treated","as","nominal","(","unordered",")","categorical","variables",".","Returns","--","--","--","-","A","bunch","containing","the","following","attributes",":","statistic",":","float","The","chi^2","test","statistic",".","df",":","int","The","degrees","of","freedom","of","the","reference","distribution","pvalue",":","float","The","p-value","for","the","test","."]
code: def test_nominal_association(self):
      """
      Assess independence for nominal factors.
  
      Assessment of independence between rows and columns using
      chi^2 testing.  The rows and columns are treated as nominal
      (unordered) categorical variables.
  
      Returns
      -------
      A bunch containing the following attributes:
  
      statistic : float
          The chi^2 test statistic.
      df : int
          The degrees of freedom of the reference distribution
      pvalue : float
          The p-value for the test.
      """
  
      statistic = np.asarray(self.chi2_contribs).sum()
      df = np.prod(np.asarray(self.table.shape) - 1)
      pvalue = 1 - stats.chi2.cdf(statistic, df)
      b = _Bunch()
      b.statistic = statistic
      b.df = df
      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 4 for calling the Table obj's underlying member method code with example usage: obj.test_nominal_association() and returns: b