Announcement

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

  • Difference-in-difference and Treatment

    Hello,

    I am supposed to use a difference and difference model to estimate the effect of mergers on the growth in R&D expenditures. I will be logging the R&D expenditures. I will also be using logSales as an independent variable. Then I need to follow the difference and difference model to create the interaction term between the treatment group and the firm type. The treatment in this case is a merger with a 1 used for each year when the firm merged. The firm type is a 1 for the firms that engaged in a merger and a 0 for the firms that did not merge during the time period of the study.

    However, I am confused how to create the treatment variable.

    My stata command comes out like this:

    xtreg logR&D firmtype logSales

    But I do not know how to make the Treatment variable for the treatment group. Then after that I need to make an interaction term between Treatment and firmtype.
    Last edited by Calvin McHenry; 25 Oct 2021, 07:19.

  • #2
    Hello Calvin. Sometimes, Google can be your friend. E.g., I just tried a search on <stata interaction vs difference in difference>, and a nice little slide show by Oscar Torres-Reyna (from Princeton University) appeared at the top of the list of results. Check it out.
    --
    Bruce Weaver
    Email: [email protected]
    Web: http://sites.google.com/a/lakeheadu.ca/bweaver/
    Version: Stata/MP 18.0 (Windows)

    Comment


    • #3
      Calvin, I assume you have a firm-level balanced panel data where some firms merged at specific points of time while others never merged through the period of study. I also assume that your data have already included a variable (e.g., w_it) indicating the status of merger: w_it = 1 if firm i has merged at t; w_it = 0 if firm i has not merged at t. Let's first discuss the simplest case: Firms which merged at some time all merged at the same time. Then you may simply run the following regression to finish the DiD analysis.

      Code:
      xtreg logRD w i.timevar, fe vce(cluster panelvar)
      w_it has already been the interaction of the two dimensions. If you are willing to generate the two dimensions, the procedure is as follows. Let's call the two variables d_i and p_t. d_i = 1 if firm i will eventually merge, and d_i = 0 if firm i will never merge. p_t = 1 for post-merger periods, and p_t = 0 for pre-merger periods.

      Code:
      bysort panelvar: egen tempvar = total(w)
      gen d = (tempvar > 0)
      sum timevar if w == 1
      gen p = (timevar >= r(min))
      drop tempvar
      It's easy to verify that w = d * p. A very nice paper of Jeff Wooldridge (https://papers.ssrn.com/sol3/papers....act_id=3906345) proves that the following two regressions are equivalent.

      Code:
      xtreg logRD w i.timevar, fe vce(cluster panelvar)
      reg logRD w d p, vce(cluster panelvar)
      If the firms merged at different points of time, then it becomes the staggered DiD. There are several solutions, but still, I love Wooldridge's solution most. Essentially, you group the firms by the timing of mergers. A simple example: some firms merged at time A, some merged at time B, and the rest never merged. Then you would generate dA_i, dB_i, pA_t, pB_t. dA_i (or dB_i) = 1 if firm i merged at time A (or B), pA_t (or pB_t) = 1 for periods after time A (or B). Then DiD codes are:

      Code:
      reg logRD c.dA#c.pA c.dB#c.pB dA dB pA pB, vce(cluster panelvar)
      Essentially there are two interaction terms capturing heterogenous effects of mergers. More details please refer to Wooldridge's paper (he also kindly provides Stata codes in his shared dropbox).

      Comment

      Working...
      X