Announcement

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

  • Measuring how a difference-in-difference indicator varies with respect to another independent variable

    Hi,

    My first step of my analysis is estimating the difference-in-difference using a regression analysis. I then want to see whether this difference-in-difference varies with respect to a different variable.

    For context, I am looking at cost pass through from a tax change where I regress price with the treatment dummy, the policy date dummy and the interaction term with controls and fixed effects included. I then want to see whether this cost pass through varies with respect to the number of locations which is a numerical variable that has values for all observations.

    I am aware it may involve further interaction terms, but I am not sure which terms to interact and why.

    Would really appreciate any help and thank you!
    Last edited by Omar Hatteea; 15 Dec 2018, 10:04. Reason: difference-in-difference

  • #2
    So if your treatment and control groups are identified by a variable called treatment (coded 1 = treatment, 0 = control), and if you have a variable called pre_post that distinguishes pre-policy date from post policy date observations (1 = post, 0 = pre). Let's just call your outcome variable y since I don't quite grasp from your description what it is. The basic analysis is
    Code:
    regressioncommand i.treatment##i.pre_post any_covariates
    If you want to then determine whether the treatment effect varies in relation to number of locations, if your variable is called n_locations, and if you want to treat it as a continuous variable, it's:

    Code:
    regressioncommand c.n_locations##i.treatment##i.pre_post any_covariates
    The output for 1.treatment#1.pre_post#n_locations will give you your estimate of the marginal effect of locations on the treatment effect. Also see the -margins- command for looking at predicted outcomes at various values of these key variables.

    In the future, when asking questions like this, please post example data and code you have tried as well as the outputs you have gotten. In constructing my response I have made a fair number of explicit and implicit assumptions that may be incorrect, and if they are incorrect my response may prove inapplicable or misleading. By providing the information you can be assured that the response you get will be appropriate.

    If you are not familiar with the -margins- command, the excellent Richard Williams has written an uncommonly lucid introduction to it: https://www3.nd.edu/~rwilliam/stats/Margins01.pdf.

    Comment


    • #3
      Ah amazing, thank you so much!

      I think the assumptions you have made are correct and sorry about the incorrect way or posting- I am new to this forum!

      My original regression was
      Code:
      reg price treatment excise_2 treatment#excise_2 controls , fe
      where excise_2 is as you say the pre_post dummy , price the outcome variable and treatment as you have defined.

      I then get an average result that says after the effect of the excise duty on the treatment is X.

      I want to then test whether the effect differs when comparing the number of gas stations surrounding each gas station, which is denoted by variable
      gs
      .

      So, using your shortcut notation, I use

      Code:
      reg price gs##i.treatment##i.excise_2 controls , r
      For some reason, when I do this I basically get only one coefficient which is repeated four times?

      ​​​​​​
      Linear regression Number of obs = 928,066
      F(0, 928059) = .
      Prob > F = .
      R-squared = 0.9945
      Root MSE = 12.15
      Robust
      gs Coef. Std. Err. t P>t [95% Conf. Interval]
      1.treatment -82.80858 1.200786 -68.96 0.000 -85.16208 -80.45508
      treatment#c.gs
      0 0 (omitted)
      1 1 9.40e-14 1.1e+13 0.000 1 1
      1.excise_2 -82.80858 1.200786 -68.96 0.000 -85.16208 -80.45508
      excise_2#c.gs
      0 0 (omitted)
      1 1 3.46e-13 2.9e+12 0.000 1 1
      treatment#excise_2
      1 1 82.80858 1.200786 68.96 0.000 80.45508 85.16208
      treatment#excise_2#c.gs
      1 1 -1 3.55e-13 -2.8e+12 0.000 -1 -1
      _cons 82.80858 1.200786 68.96 0.000 80.45508 85.16208
      I'm so grateful for your help!

      Comment

      Working...
      X