statsmodels.discrete.discrete_model.DiscreteResults.get_margeff

DiscreteResults.get_margeff(at='overall', method='dydx', atexog=None, dummy=False, count=False)[source]

Get marginal effects of the fitted model.

Parameters:
atstr, 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 from the returned object.

Note that if exog is specified, then marginal effects for all variables not specified by exog are calculated using the at option.

methodstr, 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. For interpretations of these methods see notes below.

atexogarray_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.

dummybool, 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.

countbool, 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:
DiscreteMarginsmarginal effects instance

Returns an object that holds the marginal effects, standard errors, confidence intervals, etc. See statsmodels.discrete.discrete_margins.DiscreteMargins for more information.

Notes

Interpretations of methods:

  • ‘dydx’ - change in endog for a change in exog.

  • ‘eyex’ - proportional change in endog for a proportional change in exog.

  • ‘dyex’ - change in endog for a proportional change in exog.

  • ‘eydx’ - proportional change in endog for a change in exog.

When using after Poisson, returns the expected number of events per period, assuming that the model is loglinear.


Last update: Mar 18, 2024