Hi everyone,
I have some questions about the difference-in-differences (DID) model with fixed effects.
I am dealing with a monthly panel dataset – from 2005 to 2016 – for workers and I want to study the effect of a policy introduced on January 2015.
I run the following fixed effect model, where I decided also to put the fixed effects for years and months.
Post is a dummy equal to one if year>=2015 and treat is the dummy equal to one for workers who were eligible for the treatment. To make to question simple to understand, Y is the outcome variable and it is equal to one if the worker finds a job and zero otherwise.
The outcome is the following:
I have the following three questions:
1) Is it correct to also use the months and years fixed effects? I performed the -testparm- test and it seems ok; but this cause a collinearity problem and it is quite different from the standard diff-in-diff strategy.
2) My outcome variable is a dummy equal to zero or one. Is it ok to perform a linear model? I read that for a diff-in-diff model it should be ok – I am also using vce(robust) for the SE. In this context, I tried to perform a -xtlogit- model but it takes too much time – more than 10 hours and it does not show any results.
3) How should I interpret the coefficients? I tried to use the -margins- command but I only get "(not estimable)". Instead, when I run the xtreg without the months and years fixed effects, the command works well. What should I do?
Thanks a lot!
I have some questions about the difference-in-differences (DID) model with fixed effects.
I am dealing with a monthly panel dataset – from 2005 to 2016 – for workers and I want to study the effect of a policy introduced on January 2015.
I run the following fixed effect model, where I decided also to put the fixed effects for years and months.
Post is a dummy equal to one if year>=2015 and treat is the dummy equal to one for workers who were eligible for the treatment. To make to question simple to understand, Y is the outcome variable and it is equal to one if the worker finds a job and zero otherwise.
Code:
xtset id_worker year_m xtreg Y i.treat##i.post i.year i.month, fe vce(robust)
Code:
. xtreg Y i.treat##i.post i.year i.month, fe vce(robust) note: 2016.year omitted because of collinearity Fixed-effects (within) regression Number of obs = 14,449,651 Group variable: id_worker Number of groups = 170,670 R-sq: Obs per group: within = 0.0244 min = 6 between = 0.0015 avg = 84.7 overall = 0.0191 max = 156 F(25,170669) = 1094.01 corr(u_i, Xb) = -0.3293 Prob > F = 0.0000 (Std. Err. adjusted for 170,670 clusters in id_lavoratore) ------------------------------------------------------------------------------ | Robust Y | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- 1.treat | .0109051 .0000801 136.08 0.000 .010748 .0110622 1.post | .0017448 .0004856 3.59 0.000 .0007931 .0026965 | treat#post | 1 1 | .003317 .0001612 20.57 0.000 .003001 .003633 | year | 2005 | .0022443 .0004834 4.64 0.000 .0012969 .0031917 2006 | .0020643 .0004861 4.25 0.000 .0011117 .003017 2007 | .001732 .0004855 3.57 0.000 .0007803 .0026836 2008 | .0020534 .0004858 4.23 0.000 .0011013 .0030055 2009 | .0016452 .0004855 3.39 0.001 .0006936 .0025967 2010 | .0013525 .0004855 2.79 0.005 .0004009 .0023042 2011 | .0013109 .0004856 2.70 0.007 .0003592 .0022625 2012 | .0013895 .0004855 2.86 0.004 .0004379 .0023411 2013 | .0014791 .0004856 3.05 0.002 .0005272 .0024309 2014 | .0010583 .0004855 2.18 0.029 .0001067 .0020098 2015 | -.0012254 .0000607 -20.20 0.000 -.0013444 -.0011065 2016 | 0 (omitted) | month | 2 | -.0174946 .0001178 -148.47 0.000 -.0177256 -.0172637 3 | -.0174899 .0001178 -148.44 0.000 -.0177208 -.0172589 4 | -.0175043 .0001179 -148.43 0.000 -.0177355 -.0172732 5 | -.0175121 .000118 -148.40 0.000 -.0177434 -.0172808 6 | -.0175214 .0001181 -148.38 0.000 -.0177529 -.01729 7 | -.0179749 .0001211 -148.39 0.000 -.0182123 -.0177375 8 | -.0179795 .0001212 -148.38 0.000 -.018217 -.017742 9 | -.0180004 .0001213 -148.39 0.000 -.0182382 -.0177627 10 | -.0180103 .0001214 -148.38 0.000 -.0182482 -.0177724 11 | -.0180065 .0001214 -148.35 0.000 -.0182444 -.0177686 12 | -.0180912 .0001219 -148.46 0.000 -.0183301 -.0178524 | _cons | .0135575 .0004917 27.57 0.000 .0125937 .0145212 -------------+---------------------------------------------------------------- sigma_u | .00646775 sigma_e | .0373691 rho | .02908457 (fraction of variance due to u_i) ------------------------------------------------------------------------------
I have the following three questions:
1) Is it correct to also use the months and years fixed effects? I performed the -testparm- test and it seems ok; but this cause a collinearity problem and it is quite different from the standard diff-in-diff strategy.
2) My outcome variable is a dummy equal to zero or one. Is it ok to perform a linear model? I read that for a diff-in-diff model it should be ok – I am also using vce(robust) for the SE. In this context, I tried to perform a -xtlogit- model but it takes too much time – more than 10 hours and it does not show any results.
3) How should I interpret the coefficients? I tried to use the -margins- command but I only get "(not estimable)". Instead, when I run the xtreg without the months and years fixed effects, the command works well. What should I do?
Code:
. margins treat#post Predictive margins Number of obs = 14,449,651 Model VCE : Robust Expression : Linear prediction, predict() --------------------------------------------------------------------------------------- | Delta-method | Margin Std. Err. z P>|z| [95% Conf. Interval] ----------------------+---------------------------------------------------------------- treat#post | 0 0 | . (not estimable) 0 1 | . (not estimable) 1 0 | . (not estimable) 1 1 | . (not estimable) ---------------------------------------------------------------------------------------
Comment