code: def test_resids():
      # CHD x serum data
      table = [[12, 8, 31, 41], [307, 246, 439, 245]]
  
      # These results come from SAS
      fit = [
          [22.083, 17.583, 32.536, 19.798],
          [296.92, 236.42, 437.46, 266.2],
      ]
      c2 = [
          [4.6037, 5.223, 0.0725, 22.704],
          [0.3424, 0.3885, 0.0054, 1.6886],
      ]
  
      # These are regression tests
      pr = np.array(
          [
              [-2.14562121, -2.28538719, -0.26923882, 4.7649169],
              [0.58514314, 0.62325942, 0.07342547, -1.29946443],
          ]
      )
      sr = np.array(
          [
              [-2.55112945, -2.6338782, -0.34712127, 5.5751083],
              [2.55112945, 2.6338782, 0.34712127, -5.5751083],
          ]
      )
  
      tab = ctab.Table(table)
      assert_allclose(tab.fittedvalues, fit, atol=1e-4, rtol=1e-4)
      assert_allclose(tab.chi2_contribs, c2, atol=1e-4, rtol=1e-4)
      assert_allclose(tab.resid_pearson, pr, atol=1e-4, rtol=1e-4)
      assert_allclose(tab.standardized_resids, sr, atol=1e-4, rtol=1e-4)
  
imports: import os
  import warnings
  import numpy
  import statsmodels.stats.contingency_tables
  import pandas
  from numpy.testing import assert_allclose, assert_equal
  import statsmodels.api
label_desc: Use image node_id 8 for calling a global function with example usage: test_resids() without return types