# Log transformed dependent variable with interaction terms

I have three questions regarding a regression equation where the dependent is log transformed, a dummy $D$ is interacted with yer dummies, and other independent variables are present on the right hand side: $\newcommand{\year}{{\rm year}}$

$${\rm ln}(Y) = \alpha + \beta_{0}.D + \beta_{1}.\year1990 + \beta_{2}.\year1995 + \beta_{3}.\year2000 + \beta_{4}.D.\year1990 + \beta_{5}.D.\year1995 + \beta_{6}.D.\year2000 + \beta_{7}.X + {\rm error}$$

1. How can I get the average effect of $D$ from this regression?
2. Am I right to think that the coefficient of dummy + coefficient of dummy year interaction (say for 2000) gives the percent difference relative to the same coefficients for the year dummy omitted omitted due to collinearity?
3. What would be the most meaningful interpretation of this regression?

## 2 Answers

1) The average impact of D on Y is \begin{equation} \beta_{0} +mean(0,\beta_{4},\beta_{5},\beta_{6})\end{equation}

You might want to weight the mean by the frequency with which the years appear in your dataset

2) $\beta_{0}$ is the impact of D on $Ln(Y)$ in the omitted year. Therefore, $\beta_{6}$ On it's own is the relative percentage impact D being 1 has on Y, when compared to the omitted year. I.e. if $\beta_{6}$ =0.1. Then D being equal to 1 had 10 (exp(0.1)*100) percentage point greater impact on Y in 2000.

3)It depends on what your coefficients are and what D and Y stand for!

• Thanks Morgan. 1) years are actually in sequence fofor 27byears, so what do you mean by weighting? And did yoy mean the average impact on ln of Y? Or Y? 3) Y is hours worked and D is white or not (race). – econstat Dec 15 '16 at 12:54
• If you have only 2 obervations in year1900 but 10 in year1995 then you probably want to place more weight on the coefficient attached to year1995 variable i.e. $\beta_{5}$ than you do to the coefficient attached to year1900 variable ($\beta_{4}$) when calculating the average impact of D on $Ln(Y)$ – Morgan Ball Dec 16 '16 at 15:07

The answer depends on what you mean by the average impact of $D$ on $Y$. Each of the words "average" and "impact" are ambiguous.

"Average" has to be relative to some population. The average height in the US is different from the average height in the NBA. "Impact" can be in units, how many dollars/gallons/whatever does $Y$ increase when $D$ goes from 0 to 1; it can be in percents, how many percents does $Y$ increase when $D$ goes from 0 to 1; or it can be in some other sense (though units and percents are the most common).

Suppose you are interested in the average percent impact of $D$ in your sample. You calculate that as follows. The effect for each observation in the population is:

\begin{align} \text{Effect}_i &= \beta_0 + \beta_4 yr_{1990,i} + \beta_5 yr_{1995,i} + \beta_6 yr_{2000,i} \end{align}

And the average percent effect in this population (i.e. the population consisting of your sample) is just the mean of the above:

\begin{align} \overline{\text{Effect}} &= \beta_0 + \beta_4 \overline{yr_{1990}} + \beta_5 \overline{yr_{1995}} + \beta_6 \overline{yr_{2000}} \end{align}

This is subject to the usual caveat that coefficients on dummies (and non-dummies, for that matter) in log regressions can only be interpreted as percent effects as long as the coefficients are less than about 0.2 in absolute value. Otherwise, you have to do the calculation properly.

On the other hand, if you want the average effect of $D$ on $Y$ in units, you do a different calculation. The effect of $D$ on $Y$ for a single observation is:

\begin{align} \frac{\partial Y_i}{\partial D_i} &= \left( \beta_0 + \beta_4 yr_{1990,i} + \beta_5 yr_{1995,i} + \beta_6 yr_{2000,i} \right)exp(\widehat{lnY_i}) \left( \frac{1}{N}\sum exp(e_i) \right) \end{align}

If this formula is unfamiliar to you, you might look at my answer here, for example. Or, you might search the site for the re-transformation problem or Duan's smearing estimator.

Then, if, again, you are interested in the average effect over your sample, you just take sample means:

\begin{align} \overline{\frac{\partial Y}{\partial D}} &= \left[ \frac{1}{N}\sum \left( \beta_0 + \beta_4 yr_{1990,i} + \beta_5 yr_{1995,i} + \beta_6 yr_{2000,i} \right)exp(\widehat{lnY_i}) \right] \left[ \frac{1}{N}\sum exp(e_i) \right] \end{align}

Again, there is a caveat. Since we are using a derivative (i.e. approximation) here, it's important that the individual-level percent effects, $\left( \beta_0 + \beta_4 yr_{1990,i} + \beta_5 yr_{1995,i} + \beta_6 yr_{2000,i} \right)$, not be bigger than about 0.2 in absolute value. If they are, then you have to do something else.

• Thanks @Bill, I had never heard of Duan's estimator. I will consider it for this study. In the meantime, I'm not sure if this is the right forum to ask this, but do you, or does anyone, know whether "margins r.D" and "margins r.D, expression(exp(predict(xb)))" in Stata would produce the average percent effect you mentioned above? – econstat Dec 15 '16 at 19:50
• @econstat Sorry, don't know. – Bill Dec 19 '16 at 17:01