code: def test_logit_screening():
      y, x, idx_nonzero_true, beta = _get_logit_data()
      nobs = len(y)
      # test uses
      screener_kwds = dict(pen_weight=nobs * 0.7, threshold_trim=1e-3)
  
      xnames_true = ["var%4d" % ii for ii in idx_nonzero_true]
      xnames_true[0] = "const"
      parameters = pd.DataFrame(
          beta[idx_nonzero_true], index=xnames_true, columns=["true"]
      )
  
      xframe_true = pd.DataFrame(
          x[:, idx_nonzero_true], columns=xnames_true
      )
      res_oracle = Logit(y, xframe_true).fit()
      parameters["oracle"] = res_oracle.params
  
      mod_initial = LogitPenalized(
          y, np.ones(nobs), pen_weight=nobs * 0.5
      )
      screener = VariableScreening(mod_initial, **screener_kwds)
      screener.k_max_add = 30
      exog_candidates = x[:, 1:]
      res_screen = screener.screen_exog(exog_candidates, maxiter=30)
  
      # we have extra variables, check index for larger params
      mask = np.abs(res_screen.results_final.params) > 0.1
      assert_equal(
          np.sort(res_screen.idx_nonzero[mask]), idx_nonzero_true
      )
      # regression test
      idx_r = np.array([0, 74, 100, 163, 300, 400, 411])
      assert_equal(np.sort(res_screen.idx_nonzero), idx_r)
  
      xnames = ["var%4d" % ii for ii in res_screen.idx_nonzero]
      xnames[0] = "const"
  
      # smoke test
      res_screen.results_final.summary(xname=xnames)
      res_screen.results_pen.summary()
      assert_equal(
          res_screen.results_final.mle_retvals["converged"], True
      )
  
      ps = pd.Series(
          res_screen.results_final.params, index=xnames, name="final"
      )
      # changed the following to allow for some extra params
      # parameters = parameters.join(ps, how='outer')
      parameters["final"] = ps
  
      assert_allclose(
          parameters["oracle"], parameters["final"], atol=0.005
      )
  
imports: import numpy
  from numpy.testing import assert_allclose, assert_equal
  import pandas
  from statsmodels.discrete.discrete_model import Poisson, Logit
  from statsmodels.genmod.generalized_linear_model import GLM
  from statsmodels.genmod.families import family
  from statsmodels.base._penalized import PenalizedMixin
  from statsmodels.base._screening import VariableScreening
label_desc: Use image node_id 6 for calling a global function with example usage: test_logit_screening() without return types