code: def test_formula():
      for j in 0, 1:
          np.random.seed(34234)
          n = 200
          y = np.random.randint(0, 2, size=n)
          x1 = np.random.normal(size=n)
          x2 = np.random.normal(size=n)
          g = np.random.randint(0, 25, size=n)
  
          x = np.hstack((x1[:, None], x2[:, None]))
          if j == 0:
              model1 = ConditionalLogit(y, x, groups=g)
          else:
              model1 = ConditionalPoisson(y, x, groups=g)
          result1 = model1.fit()
  
          df = pd.DataFrame({"y": y, "x1": x1, "x2": x2, "g": g})
          if j == 0:
              model2 = ConditionalLogit.from_formula(
                  "y ~ 0 + x1 + x2", groups="g", data=df
              )
          else:
              model2 = ConditionalPoisson.from_formula(
                  "y ~ 0 + x1 + x2", groups="g", data=df
              )
          result2 = model2.fit()
  
          assert_allclose(result1.params, result2.params, rtol=1e-5)
          assert_allclose(result1.bse, result2.bse, rtol=1e-5)
          assert_allclose(
              result1.cov_params(), result2.cov_params(), rtol=1e-5
          )
          assert_allclose(result1.tvalues, result2.tvalues, rtol=1e-5)
  
file_path: statsmodels/statsmodels/discrete/tests/test_conditional.py
imports: import numpy
  from statsmodels.discrete.conditional_models import ConditionalLogit, ConditionalPoisson, ConditionalMNLogit
  from statsmodels.tools.numdiff import approx_fprime
  from numpy.testing import assert_allclose
  import pandas
label_desc: Use image node_id 3 for calling a global function with example usage: test_formula() without return types