I'm running a Stata diff-in-diff regression by using an interaction term. I then try to calculate the semi-elasticity of the interaction term. The Stata code is as follows:

reg interp_tf year year_post_mayo reg_length dem_administration post_mayo is_interpretative interpretative_post_mayo, cluster(agency_num)
margins, eydx(interpretative_post_mayo) post

The interaction term interacts 2 dummy variables. I've seen some suggestions that this might be inappropriate, for example this paper: https://onlinelibrary.wiley.com/doi/pdf/10.1111/boer.12120. But the paper doesn't fully explain, and I don't understand, what the problem might be.

In addition, the margins command produces a result lower than -1, which I don't know how to interpret--e.g., if it is -1.31, does that imply a -131% change? Is that possible?

Any thoughts on either of these questions would be greatly appreciated!


1 Answer 1


I don't think the paper you cited applies since your outcome is neither logged, nor are you are using a non-linear model.

The margins, eydx(x) is calculating the average, calculated across all time periods and observations, in your estimation sample of:

$$\frac{\partial E[y \vert x]}{\partial x} \cdot \frac{1}{E[y \vert x]}=\beta_{x} \cdot \frac{1}{\hat y} \approx \frac{\frac{\Delta \hat y}{\hat y}}{\Delta x}. $$

In your case, $\Delta x =1$ since the interaction is dummy, so you have $$\frac{\Delta \hat y}{\hat y}=-1.31.$$

The numerator is change in $\hat y$ over $\hat y$, so it does make sense to multiply that by 100 to put it into percent like you did. This makes the semi-elasticity -131%. Mathematically, that could be possible, unless you outcome is bounded. For example, profits could become losses. Arrests or wages, on the other hand, are bounded below by zero, so -131% may not make much sense in that setting.

  • $\begingroup$ Thank you! That's good to know about the general validity of using semi-elasticities. On the -131%, my dependent variable (interp_tf) is indeed zero-bounded, so the result is confusing. Is that even mathematically possible, or does this imply that I have some kind of syntax error? $\endgroup$
    – Jon
    Mar 13, 2020 at 20:40
  • $\begingroup$ It's probably not a syntax error. Sometimes linear models struggle with bounded variables. It usually shows up with predictions, but sometimes can spill over to coefficients too. The solution is to try to use a non-linear model, but then the DID gets a bit tricky to interpret. An easier solution would be to try natural logging your outcome variable (and adding a small number to the zeros if necessary), and interpreting like this. An inverse hyperbolic sine in another possible transformation that can handle zeros. $\endgroup$
    – dimitriy
    Mar 13, 2020 at 20:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.