# log-log models vs margins eyex() for elasticities

I'm trying to estimate the elasticity between debt and interest rate for different values of interest. I am using a time series dataset.

I made a categorical variable for interest so that I can group the observations when running my regressions as I am interested in the elasticity between debt and interest rate for certain groups of observations.

My first option: using a log-log model

reg lnDebt lnInterest + control variables if categorical_variable_for_interest==1


My second option is

xi: reg Debt Interest + control variables
margins eyex(Interest) over(categorical_variable_for_interest)


I get different estimates for the elasticity between debt and interest for the same group of observations. If I understood the margins, eyex() command correctly it simply takes the natural log of the chosen variables to calculate d(log f)/d(log x). Does the eyex command give a more exact estimate?

• (1) If this is a time series, you should use some sort of time series models. At the very least, with Newey-West standard errors, which would make it newey rather than regress. (2) you don't have the same groups of observations and you don't have the same model; your second regression uses more data, and you assume additive main effects, while the first regression assumes multiplicative effects. There is no way on earth you'd get the same answers from these two models. (3) unless you have a really old version of Stata, you should not be using xi, but factor variable notation instead. – StasK Dec 4 '15 at 20:55
• I think your understanding of what margins, eyex() is doing can be helped by: sysuse auto, clear reg price mpg i.foreign predict yhat gen eps = _b[mpg]*mpg/yhat sum eps margins, eyex(mpg) – Dimitriy V. Masterov Dec 5 '15 at 1:19
• you should not use the xi prefix when you want to use margins. – Maarten Buis Dec 5 '15 at 10:40
• @StasK Thanks for a good answer. I'm very new to stata and it does feel like a jungle sometimes. Then using newey(or other time series model) rather than reg and then the postestimation margins would be a cleaner and better way to go. Rather than running individual log-log models for each span of interest rates I'm interested in. As I get everything in a single model, using all observations and so on. This is probably really basic I'm just a bit confused from reading the different online stata manuals. – Erik Thorén Dec 6 '15 at 15:35