I have data on a binary policy that is aggregated to a neighborhood level, meaning that for each neighborhood I have a variable for the percentage of people who are treated within the group, p_treat. The policy is implemented at the same time for all individuals, and thus all neighborhoods, and I have two pre-periods and two post-periods in my dataset. As all neighborhoods have at least one individual who is treated, I want to implement the fuzzydid command proposed by de Chaisemartin and D'Haultfoeuille.
Since I don't have only two groups and two periods, I know I need to create G_T and G_T1 groups to run this. I implement the code in their help file,
where c_id is the unique id for each neighborhood, and I use "Year -2" and "Year +2" because my data is every other year (2011, 2013, 2015, 2017). If I understand the command correctly, I want it to be that g_t= 1 for each neighborhood in the third period (first treated period) and g_t=0 for all other periods, and I want g_t1 = 1 for each neighborhood in the second period (last period before treatment) and g_t1 = 0 for all other periods. This is what happens when I run their code, so so far so good. I altered my p_treat variable so that for the first two periods it equals 0 to make that run correctly. The issue comes in when I run the fuzzydid command,
and get the following output,
Apologies for not knowing how to format that better, but essentially I get a blank table. The program does appear to be doing something, as it takes a few moments to run the default 50 bootstrap replications, but isn't working as I would hope.
As I wasn't sure if making p_treat = 0 in the pre-periods was causing the problem, I've re-run the regression but this time I simply created g_t and g_t1 to be as described above. When I run it like this, I get the following error,
When I run the regression only for the WALD_did estimator, I get the same blank table as before. When I try and utilize newcateg it gives me the same error, even when I divide p_treat into 3 groups. Any help or tips would be appreciated.
Since I don't have only two groups and two periods, I know I need to create G_T and G_T1 groups to run this. I implement the code in their help file,
Code:
sort c_id Year by c_id Year: egen mean_treat = mean(p_treat) by c_id: gen lag_mean_treat = mean_treat[_n-1] if c_id == c_id[_n-1] & Year - 2 == Year[_n-1] gen g_t = sign(mean_treat - lag_mean_treat) gen g_t1 = g_t[_n+1] if c_id==c_id[_n+1] & Year +2 == Year[_n+1]
Code:
fuzzydid Y g_t g_t1 Year p_treat, did tc cic cluster(c_id)
Estimator(s) of the local average treatment effect with bootstrapped standard errors. Cluster variable: c_id. Number of observations: 8708 .
| LATE Std_Err t p_value lower_ic upper_ic
-------------+------------------------------------------------------------------
W_DID | . . . . . .
W_TC | . . . . . .
W_CIC | . . . . . .
| LATE Std_Err t p_value lower_ic upper_ic
-------------+------------------------------------------------------------------
W_DID | . . . . . .
W_TC | . . . . . .
W_CIC | . . . . . .
As I wasn't sure if making p_treat = 0 in the pre-periods was causing the problem, I've re-run the regression but this time I simply created g_t and g_t1 to be as described above. When I run it like this, I get the following error,
Given the data structure, impossible to estimate tc, cic or lqte. Often, this error arises because the treatment takes too many values. It can then be solved using newcateg.
Comment