code: def _get_count_effects(
      effects, exog, count_ind, method, model, params
  ):
      """
      If there's a count variable, the predicted difference is taken by
      subtracting one and adding one to exog then averaging the difference
      """
      # this is the index for the effect and the index for count col in exog
      for i in count_ind:
          exog0 = exog.copy()
          exog0[:, i] -= 1
          effect0 = model.predict(params, exog0)
          exog0[:, i] += 2
          effect1 = model.predict(params, exog0)
          # NOTE: done by analogy with dummy effects but untested bc
          # stata does not handle both count and eydx anywhere
          if "ey" in method:
              effect0 = np.log(effect0)
              effect1 = np.log(effect1)
          effects[:, i] = (effect1 - effect0) / 2
      return effects
  
imports: from statsmodels.compat.python import lzip
  import numpy
  from scipy.stats import norm
  from statsmodels.tools.decorators import cache_readonly
label_desc: Use image node_id 9 for calling a global function with example usage: _get_count_effects(effects, exog, count_ind, method, model, params) and returns: effects