get_margeff(at='overall', method='dydx', atexog=None, dummy=False, count=False)¶
Get marginal effects of the fitted model.
at : str, optional
- ‘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.
method : str, optional
- ‘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 semielasticity – dy/d(lnx)
- ‘eydx’ - estimate semeilasticity – 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.
DiscreteMargins : marginal effects instance
Returns an object that holds the marginal effects, standard errors, confidence intervals, etc. See statsmodels.discrete.discrete_margins.DiscreteMargins for more information.
When using after Poisson, returns the expected number of events per period, assuming that the model is loglinear.