# Elasticity of negative binomial regression?

How to find the elasticity of a negative binomial regression when the independent variables are numeric, categorical, or dummy variables?

Edit: For example,

m1 <- glm.nb(No_of_accidents ~ JunctionType + CollisionType)


This is a negbin regression if I don't get it wrong. Now after fitting the model with data, I get two coefficients and an intercept. But the coefficients cannot be explained like the linear regression model. I can't say that if the JunctionType is a roundabout, then the no of accidents will increase by 2 times the base condition (assuming that there exists a junction type called roundabout and the beta = 2 for roundabout after fitting the model. In such a case, how do I quantify the relation between JunctionType (X) and no. of accidents (Y)? I hope it clarifies my question.

• What do you mean by the "elasticity of a negbin regression"? – Stephan Kolassa Oct 5 '20 at 4:57
• I mean the effect of a 1% change in the X variable on the expected value of Y considering X as variables and Y the dependent variable if I fit the variables in a negbin regression. For example, m1 <- glm.nb(NoOfAccidents ~ JunctionType + CollisionType , data = Data) in this model m1, the coefficients values will give an indication of increase or decrease of Y with X. But how can explain the change in Y with X in quantitative terms? – sophie Oct 6 '20 at 16:41
• Thank you, that clarifies matters. I have voted to reopen, and if it is reopened, I'll write an answer. – Stephan Kolassa Oct 7 '20 at 7:42
• Hi @StephanKolassa, the question has been reopened. I am looking forward to hearing your answer. Thank you. – sophie Oct 9 '20 at 11:15

First off, a pointer to literature: Hilbe, Negative Binomial Regression is the standard textbook on negbin regression. Very much recommended.

Now, the standard way of setting up a negative binomial regression (there are less common others) is via a log link, i.e., the mean $$\mu$$ is parameterized via a design matrix $$X$$ and coefficients $$\beta$$ as $$\log\mu = X\beta, \text{ or } \mu=\exp(X\beta).$$

I'll not distinguish between the true parameters $$\beta$$ and the estimates $$\hat{\beta}$$ in the following.

We can now distinguish different kinds of elasticity, depending on whether we are looking at a categorical/dummy predictor, or a numerical one.

## Change in a dummy predictor

Assume we have $$\mu_1=\exp(x_1\beta)$$ and $$\mu_2=\exp(x_2\beta)$$, two fitted means, where the design matrix row vectors $$x_1$$ and $$x_2$$ differ in that one dummy flips from $$0$$ (in $$x_1$$) to $$1$$ (in $$x_2$$). That is, $$x_2-x_1$$ is a vector of $$0$$s and a single $$1$$ in the place at which the flipping predictor sits. Assume that this is the $$j$$-th entry. Then

$$\frac{\mu_2}{\mu_1} = \frac{\exp(x_2\beta)}{\exp(x_1\beta)} = \exp\big((x_2-x_1)\beta\big) = \exp(\beta_j).$$

That is, flipping the $$j$$-th dummy from $$0$$ to $$1$$ will multiply the fitted mean by $$\exp(\beta_j)$$.

## Change in a categorical predictor

Categorical predictors with $$k$$ factor levels are (again: commonly) represented internally as $$k-1$$ dummy predictors, for which the calculation above holds. Thus, switching from the reference category to the $$j$$-th (non-reference) category will change the fitted mean multiplicatively by $$\exp(\beta_j)$$. Changing from the $$k$$-th (non-reference) category to the $$j$$-th (non-reference) category will change the mean multiplicatively by $$\exp(\beta_j-\beta_k)$$.

## Additive change in a numerical predictor

We again have to deal with design matrix row vectors $$x_1-x_2$$, which will again be a vector of $$0$$s except for the entry in which the changing predictor sits. So we can just assume that we have a single predictor that first takes a value $$x$$ (for a fitted mean of $$\mu_1=\exp(x\beta)$$) and then changes to $$x+\Delta x$$ (for a fitted mean of $$\mu_2 = \exp\big((x+\Delta x)\beta\big)$$). We obtain

$$\frac{\mu_2}{\mu_1} = \frac{\exp\big((x+\Delta x)\beta\big)}{\exp(x\beta)} = \exp(\Delta x\beta).$$

So changing a predictor by an additive $$\Delta x$$ will yield a multiplicative change of $$\exp(\Delta x\beta)$$ in the fitted mean, where $$\beta$$ is the coefficient corresponding to the changing predictor.

## Multiplicative or percentage change in a numerical predictor

Assume a predictor's value changes multiplicatively, from $$x$$ to $$cx$$. As above, we get

$$\frac{\mu_2}{\mu_1} = \frac{\exp(cx\beta)}{\exp(x\beta)} = \exp\big((c-1) x\beta\big).$$

So in this case, the multiplicative change depends on the initial value $$x$$ of the predictor, in contrast to the effect of an additive change in the predictor, which per above does not depend on this initial value $$x$$.

## Infinitesimal change in a numerical predictor

The economic definition of elasticity is the change in the effect as the predictor changes by an infinitesimal amount:

$$\frac{\partial\mu/\mu}{\partial x/x} = \frac{\partial\mu}{\partial x}\frac{x}{\mu}.$$

For $$\mu=\exp(X\beta)$$, we have

$$\frac{\partial\mu}{\partial x_j} = \frac{\partial}{\partial x_j}\exp(X\beta) = \beta_j\exp(X\beta) = \beta_j\mu,$$

so

$$\frac{\partial\mu}{\partial x_j}\frac{x_j}{\mu} = \beta_j\mu\frac{x_j}{\mu} = \beta_jx_j.$$

Thus, the elasticity of $$\mu$$ with respect to the $$j$$-th predictor is $$\beta_jx_j$$ - so it again depends on the value $$x_j$$ of the $$j$$-th predictor at which we calculate the elasticity.

• Thank you so much for your answer. It clarifies all my confusion. – sophie Oct 11 '20 at 7:59