Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Mechanics of FE in DiD estimation

    It is not clear to me how the FE demeaning mechanically affects an estimation, especially with respect to a difference-in-differences estimation.

    To clarify things, I created a toy data set to test what goes on when I use FE in a DiD regression, with twelve observations in two states and three sectors where I observe an effect in only one state-sector pair with on pre- and one post- entry per observation (dataset printout below).

    If I run a simple DiD regression:

    xtset firm_id
    xtreg y i.treat i.post i.treat##i.post, vce(cluster firm_id)


    the interaction effect comes out as 0.5. This being (mechanically) the effect in the only state-sector pair (i.e. 3), by the number of pairs (6).
    However, when I add state FE and sector FE:

    xtreg y i.treat i.post i.treat##i.post i.sector i.state, vce(cluster firm_id)

    it is not clear to me how Stata calculates them, and why the interaction effect in the estimation does not change (when it does in the real dataset I work with).

    firm_id post treat y sector state
    1 0 1 1 a s_1
    2 0 0 0 a s_1
    3 0 1 1 a s_2
    4 0 0 0 a s_2
    5 0 1 1 b s_1
    6 0 0 0 b s_1
    7 0 1 1 b s_2
    8 0 0 0 b s_2
    9 0 1 1 c s_1
    10 0 0 0 c s_1
    11 0 1 1 c s_2
    12 0 0 0 c s_2
    1 1 1 5 a s_1
    2 1 0 1 a s_1
    3 1 1 2 a s_2
    4 1 0 1 a s_2
    5 1 1 2 b s_1
    6 1 0 1 b s_1
    7 1 1 2 b s_2
    8 1 0 1 b s_2
    9 1 1 2 c s_1
    10 1 0 1 c s_1
    11 1 1 2 c s_2
    12 1 0 1 c s_2

  • #2
    In your toy data set, the variable treat is independent of the state and sector variables. Consequently, adding state and sector to the regression does not change any estimates associated with treat. In your real data, it is likely that treat is not completely independent of state and sector--reality is rarely that simple. When you introduce new variables into a model, the results for variables already there usually change--the only time they don't change is when the newly introduced variables are completely independent of the ones already there.

    In the future, when showing data examples, please use the -dataex- command to do so. If you are running version 15.1 or a fully updated version 14.2, -dataex- is already part of your official Stata installation. If not, run -ssc install dataex- to get it. Either way, run -help dataex- to read the simple instructions for using it. -dataex- will save you time; it is easier and quicker than typing out tables. It includes complete information about aspects of the data that are often critical to answering your question but cannot be seen from tabular displays or screenshots. It also makes it possible for those who want to help you to create a faithful representation of your example to try out their code, which in turn makes it more likely that their answer will actually work in your data.

    Comment


    • #3
      Dear Clyde, thank you very much for your answer and insight.

      The toy example was put there for ease of explanation of the other question I posed, meaning the calculation of state and sector FE, which are respectively -.375 (for both sector 2 and 3 w.r.t. sector 1), and -.25 for state 2 w.r.t. state 1.
      If the interaction effect is somewhat close to an average treatment effect across sector-state groups (i.e. (3+0+0+0+0+0)/6=0.5 ) i cannot yet figure out, how the two FE are actually calculated in the simple scenario.
      I ask for a matter of interpretation of the more general case.

      Comment


      • #4
        Originally posted by Mark Bert View Post
        If the interaction effect is somewhat close to an average treatment effect across sector-state groups (i.e. (3+0+0+0+0+0)/6=0.5 ) i cannot yet figure out, how the two FE are actually calculated in the simple scenario.
        I ask for a matter of interpretation of the more general case.
        I don't understand the first sentence. If you want help interpreting some outputs that you don't feel you understand, then post those actual outputs and state, with reference to specific terms and numbers, what it is you would like explained.


        Comment

        Working...
        X