I am trying to understand the tfdiff command before applying it to my data. To do so, I simulated some variables as follow:
Code:
clear all set obs 2000 // set the number of individuals set seed 101 // set seed to obtain the same results generate id=_n // generate individual specific ID generate Treated=1 if _n>=1000 //Treatment=1 for the second half of the sample replace Treated=0 if Treated==. expand 11 // create 11 observations (years) for each initial by id, sort: generate time=_n // year of observation *create fake y's *small changes generate c=rnormal(0,0.001) * y before treatment gen y=. replace y=0.5+c replace y=0.8+c if time>6 & Treated==1 *tfdiff where the treatment is in year 6 tfdiff y Treated, model(fe) pvar(id) tvar(time) t(6) datatype(panel) test_pt graph ci(10) vce(r) save_graph(second) save_results(secondresults)
However, the tfdiff command does not work and I get the following error:
Code:
tfdiff y Treated, model(fe) pvar(id) tvar(time) t(6) datatype(panel) test_pt graph ci(10) vce(r) save_graph(second) save_results(secondresults)
***********************************************************
Data type: PANEL
***********************************************************
***********************************************************
Model type: Fixed-effect
***********************************************************
panel variable: id (strongly balanced)
time variable: time, 1 to 11
delta: 1 unit
note: 1.Treated omitted because of collinearity
Fixed-effects (within) regression Number of obs = 22,000
Group variable: id Number of groups = 2,000
R-sq: Obs per group:
within = 0.9999 min = 11
between = 1.0000 avg = 11.0
overall = 0.9999 max = 11
F(20,1999) = 1.32e+07
corr(u_i, Xb) = 0.0167 Prob > F = 0.0000
(Std. Err. adjusted for 2,000 clusters in id)
------------------------------------------------------------------------------
| Robust
y | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
1._D2 | -.0000507 .0000451 -1.12 0.262 -.0001392 .0000378
1._D3 | .0000433 .0000442 0.98 0.328 -.0000435 .0001301
1._D4 | .0000112 .0000438 0.26 0.799 -.0000748 .0000972
1._D5 | -.0000242 .000045 -0.54 0.592 -.0001124 .0000641
1._D6 | .0000199 .000044 0.45 0.651 -.0000664 .0001062
1._D7 | .000021 .0000448 0.47 0.639 -.0000669 .0001089
1._D8 | .0000207 .0000443 0.47 0.640 -.0000661 .0001075
1._D9 | -8.99e-06 .0000459 -0.20 0.845 -.0000991 .0000811
1._D10 | 5.46e-06 .0000424 0.13 0.898 -.0000777 .0000886
1._D11 | -.0000241 .0000446 -0.54 0.590 -.0001116 .0000635
|
Treated#_D2 |
1 1 | .0000844 .0000631 1.34 0.181 -.0000393 .0002081
|
Treated#_D3 |
1 1 | 8.52e-06 .000062 0.14 0.891 -.0001131 .0001302
|
Treated#_D4 |
1 1 | -.0000217 .0000627 -0.35 0.729 -.0001447 .0001013
|
Treated#_D5 |
1 1 | .0000183 .0000645 0.28 0.776 -.0001081 .0001448
|
Treated#_D6 |
1 1 | -.0000747 .0000633 -1.18 0.238 -.0001989 .0000495
|
Treated#_D7 |
1 1 | .2999783 .0000648 4629.74 0.000 .2998512 .3001054
|
Treated#_D8 |
1 1 | .2999739 .0000623 4817.36 0.000 .2998517 .300096
|
Treated#_D9 |
1 1 | .3000474 .000064 4690.53 0.000 .299922 .3001729
|
Treated#_D10 |
1 1 | .3000106 .0000618 4856.36 0.000 .2998894 .3001317
|
Treated#_D11 |
1 1 | .3000671 .0000624 4811.29 0.000 .2999448 .3001894
|
_cons | .5000022 .0000212 2.4e+04 0.000 .4999607 .5000437
-------------+----------------------------------------------------------------
sigma_u | .00030983
sigma_e | .0010023
rho | .08721817 (fraction of variance due to u_i)
------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
******************************************************************************
**************** TEST FOR 'PARALLEL TREND' ***********************************
******************************************************************************
Null to be tested:
_b[1.w]=_b[1.w#1._D2]= _b[1.w#1._D3]= _b[1.w#1._D4]=0
[1.w] not found
r(111);Thanks a lot for your help,
Best,
Pierre
0 Response to Help in understanding tfdiff
Post a Comment