Dear statalist,
I'm doing a (generalized?) DiD with firm and year fixed effects. In my sample, different firms switch to a certain status in different years, post =1 if the year is the switch year or the years after switch, treat =1 if the firm switched to a certain status in a particular year (i.e., treat =1 only for the year switch happens).
From my understanding, this two-way fixed effects model would only have the interaction term, but not the individual terms of treat and post. I tried two ways of calculating the interaction term:
1. manually calculate before running the regression
the regression result:
2. include i.treat#i.post in the regression
the regression result:
So my questions:
1. Which one is the correct way to do a DiD with two-way fixed effects?
2. What are the 0 1, 1 0, 1 1 in the second one mean? And why one of them is empty (has no observations)?
3. when using -xtreg-, where are 3 R^2 reported: within, between and overall. Which one should I mainly focus on and report?
Here is the 3 R^2 for the first regression:
4. Is the first model a generalized DiD? I read https://www.statalist.org/forums/for...tion-look-like and the paper mentioned in that post https://www.annualreviews.org/doi/pd...-040617-013507, in p2 of the paper, it says "let Dgt = 1 if unit g is exposed to treatment in period t, and Dgt = 0 if unit g is exposed to the control condition in period t", and the model is Ygt = ag + bt + δDgt + εgt. So the Dgt variable in fact has two layers, 1) the unit is treated and 2) the time period now is after the treatment happens. With my limited understanding, my variable, treat_post, has a similar meaning to that of Dgt? So my first model is a generalized DiD?
Thanks a lot for your help.
I'm doing a (generalized?) DiD with firm and year fixed effects. In my sample, different firms switch to a certain status in different years, post =1 if the year is the switch year or the years after switch, treat =1 if the firm switched to a certain status in a particular year (i.e., treat =1 only for the year switch happens).
From my understanding, this two-way fixed effects model would only have the interaction term, but not the individual terms of treat and post. I tried two ways of calculating the interaction term:
1. manually calculate before running the regression
Code:
gen treat_post = treat*post xtreg y treat_post controls i.year if _weight!=. , fe robust
Code:
------------------------------------------------------------------------------------------ | Robust y | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------------------+---------------------------------------------------------------- treat_post | .2432795 .1246816 1.95 0.052 -.0020436 .4886026
Code:
xtreg y i.treat#i.post controls i.year if _weight!=. , fe robust
Code:
------------------------------------------------------------------------------------------ | Robust y | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------------------+---------------------------------------------------------------- treat#post | 0 1 | -.8282567 .3271798 -2.53 0.012 -1.472015 -.1844989 1 0 | 0 (empty) 1 1 | -.2441863 .239058 -1.02 0.308 -.714556 .2261834
So my questions:
1. Which one is the correct way to do a DiD with two-way fixed effects?
2. What are the 0 1, 1 0, 1 1 in the second one mean? And why one of them is empty (has no observations)?
3. when using -xtreg-, where are 3 R^2 reported: within, between and overall. Which one should I mainly focus on and report?
Here is the 3 R^2 for the first regression:
Code:
R-sq: within = 0.2939 between = 0.1037 overall = 0.1224
Thanks a lot for your help.
Comment