0

I ran some FE regressions in Stata using xtreg. One “normal” fixed effects model and a second generalized difference-in-differences model. Now, I am wondering how the code would look translated into a mathematical equation. Please find the code below:

xtreg profit i.post employees i.year, fe

xtreg profit i.post#i.treat i.treat employees i.year, fe

I think the basic syntax for both will be something like $$y_{it}=ß_1x_{it}+ß_2z_{it}+u_t+a_i+e_{it}$$

But I don’t know how to add the interaction terms and how many error and/or terms for fixed variables needs to be included (especially regarding the term i.year). I found several different equations on the internet or in books, so I am very confused at the moment.

I’d appreciate any kind of help!

Jeremy Miles
  • 17,812
Sam
  • 95
  • Is $x_{it}$ the dichotomous treatment variable? And, I’m guessing $z_{it}$ is employees? Do you have any other controls? What’s your field of study? – Thomas Bilach Sep 22 '22 at 15:41
  • The equation should just place an example of what I want to get. I see, it’s a bit irritating, sorry! However, the treatment effect is represented by the interaction of post and treat and is dichotomous. Employees is numeric. ‘i.year’ should control for period fixed effects. I am wondering especially regarding error terms. Due the fact, I ran a two-way-FE model, Stata automatically controls for unit and time fixed effects. But how do I have to state that in the equation? – Sam Sep 22 '22 at 16:45

1 Answers1

0

In your previous post, it appears you're modeling the effect of firm mergers on profitability. The "timing" of the mergers happen in different years, so the interaction term is not well-defined. However, a single dichotomous treatment variable that 'turns on' (i.e., switches from 0 to 1) for the treated firms in their respective post-treatment years is sufficient. It is the interaction term just defined in a different way. I go into great detail on how to code this type of policy/treatment variable here.

The "generalized" difference-in-differences equation below is not much different than the one you outlined above, but it's a bit more explicit in my estimation:

$$ \mathit{Profit}_{it} = \gamma_i + \lambda_t + \delta \mathit{Merger}_{it} + \theta \mathit{Employees}_{it} + e_{it}, $$

where we regress profits on a full set of firm effects $\gamma_i$, a full set of year effects $\lambda_t$, and a dichotomous treatment variable $\mathit{Merger}_{it}$. The variable $\mathit{Employees}_{it}$ is a time-varying covariate and is appropriate to include in this setting. If you have a lot of covariates, then include $X_{it}$ and say it's a vector of potentially time-varying firm level characteristics. However, if you're only adjusting for employees, then writing it out explicitly won't eat up too much space.

...I don’t know how to add the interaction terms and how many error and/or terms for fixed variables needs to be included (especially regarding the term i.year).

It's sufficient to use "parameters" to denote the fixed effects. You do not need to write out some complicated error structure. Including $\lambda_t$ is mathematical shorthand; it's telling your audience that you included a full set of year dummies on the right-hand side of your equation. Since you're only working with a finite number of years, you're actually adjusting for the time shocks directly.

Note, the estimate of $\delta$ is a single summary measure of the treatment effect. It's also commonly referred to as a static treatment effect. But is one coefficient sufficient to explain the effect of mergers on profits? Do you suspect some sort of dynamic response in the post-merger era? Some authors write out the different leads and lags of $\mathit{Merger}_{it}$ using dummy variable notation, others just include the base model and build upon it later when they present their regression results. It depends on how fancy you want to get.

Specifying a difference-in-differences equation with "interaction terms" to show how the treatment varies with the time since the first merger is a bit more difficult. A review of your Stata code suggests you want to estimate an "event study" model. The specification below seems appropriate:

$$ \mathit{Profit}_{it} = \gamma_i + \lambda_t + \sum^{-q}_{\tau = m} \delta_{\tau} \cdot M_i \cdot \textbf{1}(t - T_i = \tau) + \theta \mathit{Employees}_{it} + e_{it}, $$

where we introduce a variable $M_i$, which is set to 1 if a firm has ever merged, 0 otherwise. Note the subscript $i$; it does not vary over time. To obtain estimates before and after a merger, we interact $M_i$ with the "event time" indicator function $\textbf{1}(t - T_i = \tau)$, which is set to 1 if the observation time is $\tau$ = $-q...,0,...m$ years from $T_i$, the first merger year for firm $i$. You can think of this computation as centering all firms around that first merger year.

The model you specified in your post seems okay to me. Just be very clear about what your variables represent.

Thomas Bilach
  • 5,999
  • 2
  • 11
  • 33