code: def test_rate_poisson_ratio_consistency(method):
      compare = "ratio"
      # check consistency between test and confint for ratio of poisson rates
      count1, n1, count2, n2 = 30, 400 / 10, 7, 300 / 10  # avoid low=0
      ci = confint_poisson_2indep(
          count1, n1, count2, n2, method=method, compare=compare
      )
      pv1 = smr.test_poisson_2indep(
          count1,
          n1,
          count2,
          n2,
          value=ci[0],
          method=method,
          compare=compare,
      ).pvalue
      pv2 = smr.test_poisson_2indep(
          count1,
          n1,
          count2,
          n2,
          value=ci[1],
          method=method,
          compare=compare,
      ).pvalue
  
      rtol = 1e-10
      if method in ["score", "score-log"]:
          # numerical root finding, lower precision
          rtol = 1e-6
      assert_allclose(pv1, 0.05, rtol=rtol)
      assert_allclose(pv2, 0.05, rtol=rtol)
  
      # check one-sided, note all confint are central
      pv1 = smr.test_poisson_2indep(
          count1,
          n1,
          count2,
          n2,
          value=ci[0],
          method=method,
          compare=compare,
          alternative="larger",
      ).pvalue
      pv2 = smr.test_poisson_2indep(
          count1,
          n1,
          count2,
          n2,
          value=ci[1],
          method=method,
          compare=compare,
          alternative="smaller",
      ).pvalue
  
      assert_allclose(pv1, 0.025, rtol=rtol)
      assert_allclose(pv2, 0.025, rtol=rtol)
  
imports: import pytest
  import warnings
  import numpy
  from numpy import arange
  from numpy.testing import assert_allclose, assert_equal
  from scipy import stats
  import statsmodels.stats.rates
  from statsmodels.stats.rates import confint_poisson, tolerance_int_poisson, confint_quantile_poisson, etest_poisson_2indep, confint_poisson_2indep, nonequivalence_poisson_2indep, power_poisson_ratio_2indep, power_equivalence_poisson_2indep, power_poisson_diff_2indep, power_equivalence_neginb_2indep, power_negbin_ratio_2indep, method_names_poisson_1samp, method_names_poisson_2indep
label_desc: Use image node_id 5 for calling a global function with example usage: test_rate_poisson_ratio_consistency(method) without return types