class_docstr: Get marginal effects of a Discrete Choice model.
  
  Parameters
  ----------
  results : DiscreteResults instance
      The results instance of a fitted discrete choice model
  args : tuple
      Args are passed to `get_margeff`. This is the same as
      results.get_margeff. See there for more information.
  kwargs : dict
      Keyword args are passed to `get_margeff`. This is the same as
      results.get_margeff. See there for more information.
docstr: Get marginal effects of the fitted model.
  
  Parameters
  ----------
  at : str, optional
      Options are:
  
      - 'overall', The average of the marginal effects at each
        observation.
      - 'mean', The marginal effects at the mean of each regressor.
      - 'median', The marginal effects at the median of each regressor.
      - 'zero', The marginal effects at zero for each regressor.
      - 'all', The marginal effects at each observation. If `at` is all
        only margeff will be available.
  
      Note that if `exog` is specified, then marginal effects for all
      variables not specified by `exog` are calculated using the `at`
      option.
  method : str, optional
      Options are:
  
      - 'dydx' - dy/dx - No transformation is made and marginal effects
        are returned.  This is the default.
      - 'eyex' - estimate elasticities of variables in `exog` --
        d(lny)/d(lnx)
      - 'dyex' - estimate semi-elasticity -- dy/d(lnx)
      - 'eydx' - estimate semi-elasticity -- d(lny)/dx
  
      Note that tranformations are done after each observation is
      calculated.  Semi-elasticities for binary variables are computed
      using the midpoint method. 'dyex' and 'eyex' do not make sense
      for discrete variables.
  atexog : array_like, optional
      Optionally, you can provide the exogenous variables over which to
      get the marginal effects.  This should be a dictionary with the key
      as the zero-indexed column number and the value of the dictionary.
      Default is None for all independent variables less the constant.
  dummy : bool, optional
      If False, treats binary variables (if present) as continuous.  This
      is the default.  Else if True, treats binary variables as
      changing from 0 to 1.  Note that any variable that is either 0 or 1
      is treated as binary.  Each binary variable is treated separately
      for now.
  count : bool, optional
      If False, treats count variables (if present) as continuous.  This
      is the default.  Else if True, the marginal effect is the
      change in probabilities when each observation is increased by one.
  
  Returns
  -------
  effects : ndarray
      the marginal effect corresponding to the input options
  
  Notes
  -----
  When using after Poisson, returns the expected number of events
  per period, assuming that the model is loglinear.
docstr_tok: ["Get","marginal","effects","of","the","fitted","model",".","Parameters","--","--","--","--","--","at",":","str",",","optional","Options","are",":","-","'overall","'",",","The","average","of","the","marginal","effects","at","each","observation",".","-","'mean","'",",","The","marginal","effects","at","the","mean","of","each","regressor",".","-","'median","'",",","The","marginal","effects","at","the","median","of","each","regressor",".","-","'zero","'",",","The","marginal","effects","at","zero","for","each","regressor",".","-","'all","'",",","The","marginal","effects","at","each","observation",".","If","`","at","`","is","all","only","margeff","will","be","available",".","Note","that","if","`","exog","`","is","specified",",","then","marginal","effects","for","all","variables","not","specified","by","`","exog","`","are","calculated","using","the","`","at","`","option",".","method",":","str",",","optional","Options","are",":","-","'dydx","'","-","dy\/dx","-","No","transformation","is","made","and","marginal","effects","are","returned",".","This","is","the","default",".","-","'eyex","'","-","estimate","elasticities","of","variables","in","`","exog","`","--","d","(","lny",")","\/d","(","lnx",")","-","'dyex","'","-","estimate","semi-elasticity","--","dy\/d","(","lnx",")","-","'eydx","'","-","estimate","semi-elasticity","--","d","(","lny",")","\/dx","Note","that","tranformations","are","done","after","each","observation","is","calculated",".","Semi-elasticities","for","binary","variables","are","computed","using","the","midpoint","method",".","'dyex","'","and","'eyex","'","do","not","make","sense","for","discrete","variables",".","atexog",":","array_like",",","optional","Optionally",",","you","can","provide","the","exogenous","variables","over","which","to","get","the","marginal","effects",".","This","should","be","a","dictionary","with","the","key","as","the","zero-indexed","column","number","and","the","value","of","the","dictionary",".","Default","is","None","for","all","independent","variables","less","the","constant",".","dummy",":","bool",",","optional","If","False",",","treats","binary","variables","(","if","present",")","as","continuous",".","This","is","the","default",".","Else","if","True",",","treats","binary","variables","as","changing","from","0","to","1",".","Note","that","any","variable","that","is","either","0","or","1","is","treated","as","binary",".","Each","binary","variable","is","treated","separately","for","now",".","count",":","bool",",","optional","If","False",",","treats","count","variables","(","if","present",")","as","continuous",".","This","is","the","default",".","Else","if","True",",","the","marginal","effect","is","the","change","in","probabilities","when","each","observation","is","increased","by","one",".","Returns","--","--","--","-","effects",":","ndarray","the","marginal","effect","corresponding","to","the","input","options","Notes","--","--","-","When","using","after","Poisson",",","returns","the","expected","number","of","events","per","period",",","assuming","that","the","model","is","loglinear","."]
code: def get_margeff(
      self,
      at="overall",
      method="dydx",
      atexog=None,
      dummy=False,
      count=False,
  ):
      """Get marginal effects of the fitted model.
  
      Parameters
      ----------
      at : str, optional
          Options are:
  
          - 'overall', The average of the marginal effects at each
            observation.
          - 'mean', The marginal effects at the mean of each regressor.
          - 'median', The marginal effects at the median of each regressor.
          - 'zero', The marginal effects at zero for each regressor.
          - 'all', The marginal effects at each observation. If `at` is all
            only margeff will be available.
  
          Note that if `exog` is specified, then marginal effects for all
          variables not specified by `exog` are calculated using the `at`
          option.
      method : str, optional
          Options are:
  
          - 'dydx' - dy/dx - No transformation is made and marginal effects
            are returned.  This is the default.
          - 'eyex' - estimate elasticities of variables in `exog` --
            d(lny)/d(lnx)
          - 'dyex' - estimate semi-elasticity -- dy/d(lnx)
          - 'eydx' - estimate semi-elasticity -- d(lny)/dx
  
          Note that tranformations are done after each observation is
          calculated.  Semi-elasticities for binary variables are computed
          using the midpoint method. 'dyex' and 'eyex' do not make sense
          for discrete variables.
      atexog : array_like, optional
          Optionally, you can provide the exogenous variables over which to
          get the marginal effects.  This should be a dictionary with the key
          as the zero-indexed column number and the value of the dictionary.
          Default is None for all independent variables less the constant.
      dummy : bool, optional
          If False, treats binary variables (if present) as continuous.  This
          is the default.  Else if True, treats binary variables as
          changing from 0 to 1.  Note that any variable that is either 0 or 1
          is treated as binary.  Each binary variable is treated separately
          for now.
      count : bool, optional
          If False, treats count variables (if present) as continuous.  This
          is the default.  Else if True, the marginal effect is the
          change in probabilities when each observation is increased by one.
  
      Returns
      -------
      effects : ndarray
          the marginal effect corresponding to the input options
  
      Notes
      -----
      When using after Poisson, returns the expected number of events
      per period, assuming that the model is loglinear.
      """
      self._reset()  # always reset the cache when this is called
      # TODO: if at is not all or overall, we can also put atexog values
      # in summary table head
      method = method.lower()
      at = at.lower()
      _check_margeff_args(at, method)
      self.margeff_options = dict(method=method, at=at)
      results = self.results
      model = results.model
      params = results.params
      exog = model.exog.copy()  # copy because values are changed
      effects_idx, const_idx = _get_const_index(exog)
  
      if dummy:
          _check_discrete_args(at, method)
          dummy_idx, dummy = _get_dummy_index(exog, const_idx)
      else:
          dummy_idx = None
  
      if count:
          _check_discrete_args(at, method)
          count_idx, count = _get_count_index(exog, const_idx)
      else:
          count_idx = None
  
      # attach dummy_idx and cout_idx
      self.dummy_idx = dummy_idx
      self.count_idx = count_idx
  
      # get the exogenous variables
      exog = _get_margeff_exog(exog, at, atexog, effects_idx)
  
      # get base marginal effects, handled by sub-classes
      effects = model._derivative_exog(
          params, exog, method, dummy_idx, count_idx
      )
  
      J = getattr(model, "J", 1)
      effects_idx = np.tile(
          effects_idx, J
      )  # adjust for multi-equation.
  
      effects = _effects_at(effects, at)
  
      if at == "all":
          if J > 1:
              K = model.K - np.any(~effects_idx)  # subtract constant
              self.margeff = effects[:, effects_idx].reshape(
                  -1, K, J, order="F"
              )
          else:
              self.margeff = effects[:, effects_idx]
      else:
          # Set standard error of the marginal effects by Delta method.
          margeff_cov, margeff_se = margeff_cov_with_se(
              model,
              params,
              exog,
              results.cov_params(),
              at,
              model._derivative_exog,
              dummy_idx,
              count_idx,
              method,
              J,
          )
  
          # reshape for multi-equation
          if J > 1:
              K = model.K - np.any(~effects_idx)  # subtract constant
              self.margeff = effects[effects_idx].reshape(
                  K, J, order="F"
              )
              self.margeff_se = margeff_se[effects_idx].reshape(
                  K, J, order="F"
              )
              self.margeff_cov = margeff_cov[effects_idx][
                  :, effects_idx
              ]
          else:
              # do not care about at constant
              # hack truncate effects_idx again if necessary
              # if eyex, then effects is truncated to be without extra params
              effects_idx = effects_idx[: len(effects)]
              self.margeff_cov = margeff_cov[effects_idx][
                  :, effects_idx
              ]
              self.margeff_se = margeff_se[effects_idx]
              self.margeff = effects[effects_idx]
  
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 8 for calling the DiscreteMargins obj's underlying member method code with example usage: obj.get_margeff(at, method, atexog, dummy, count) without return types