Dear Stata community,
If possible, I'd like to direct this enquiry to professor Rios-Avila FernandoRios but I'd be happy if anyone could help.
I am studying the effects of a policy implemented in 2012 on students' scores. My data is pooled from repeated crosssections from standardised exams from 2010 to 2018 at individual level. I have two variables "treat" (or D=1) and "policy" (T=1 after the treatment, 0 otherwise), the former indicates whether the individual is eligible for treatment (there are observations before and after the treatment); the latter indicates whether the period is before or after the treatment. The outcome variable is the students scores (standardised by year with mean=0 sd=1).
My TWFE DiD estimator should be the coefficient of treat#policy. I managed to calculate the atet with DRDID and CSDID and to generate my gvar, which is great after long time struggling! And, as expected, the average effects were not different from zero. Although, I only have two years of pretreatment, my pretrends test failed to reject the null, thus, I can assume that PT holds (though we can never know for sure).
However, effects are heterogeneous and vary considerably along the distribution of the outcome variable, so I am using rifhdreg to estimate QTE, but I'm still struggling with the use of the option "over". I tried using the following a code I found in one of the previous threads:
When I substitute "dd" by "treat", it works fine. But I still doubt whether it is right.
My questions:
QUESTION #1: How is reweighting calculated? I know it uses IPW but if I don't indicate the time before and after, it will calculate the weights of treated x untreated during all the period, isn't it so? How do I know that weighting is done only at pre-treatment period? I understand that trimming does the common support, but how is it being done? If not, should I adjust my variable? Sorry if I'm missing something here, in fact, I just want to make sure that my design is correct.
QUESTION #2: How do I know how many observations from my sample are being considered ? Because the other thing is that I notice after reweighting most of my estimates are not significant. I'm practically working with the entire population (N=10 MM) and I find strange those large CIs. It could be because of the previous problem or else, could it be because I'm using a triple interaction? This is happening to nearly all the variables I use mostly for triple interactions but also some single interactions as well. I notice the more controls I use, the larger the CIs, which makes sense but is there a way to know the best variables to consider?
Anyway, the graph below illustrates this problem and still considering the triple interaction. Here is my code:

From the graph above I can say that the effects for blacks was only positive for higher quantiles. That also makes sense, but still striking that CIs are so large for the amount of data I have. Unfortunately, I cannot run QREG or BSQREG with my data (I can only do that without covariates) to compare. Of course, I'm aware that it wouldn't give me the effects on the whole distribution which I am interested at considering my outcome variable is a relative rank.
QUESTION #3: bootstraps: due to the size of my dataset (N= 10 MM), I can't calculate use bootstraps to calculate my SEs is it possible to identify QTE just by clustering my errors? Is there another way of doing it with large datasets?
QUESTION #4: Suppose only the double interaction, as code below, I'm a bit confused about robustness checks for identifying QTE. Could anyone help me with that?
I'm sorry for the long thread and so many questions.
Thanks a lot for the help!
Sandra
If possible, I'd like to direct this enquiry to professor Rios-Avila FernandoRios but I'd be happy if anyone could help.
I am studying the effects of a policy implemented in 2012 on students' scores. My data is pooled from repeated crosssections from standardised exams from 2010 to 2018 at individual level. I have two variables "treat" (or D=1) and "policy" (T=1 after the treatment, 0 otherwise), the former indicates whether the individual is eligible for treatment (there are observations before and after the treatment); the latter indicates whether the period is before or after the treatment. The outcome variable is the students scores (standardised by year with mean=0 sd=1).
My TWFE DiD estimator should be the coefficient of treat#policy. I managed to calculate the atet with DRDID and CSDID and to generate my gvar, which is great after long time struggling! And, as expected, the average effects were not different from zero. Although, I only have two years of pretreatment, my pretrends test failed to reject the null, thus, I can assume that PT holds (though we can never know for sure).
However, effects are heterogeneous and vary considerably along the distribution of the outcome variable, so I am using rifhdreg to estimate QTE, but I'm still struggling with the use of the option "over". I tried using the following a code I found in one of the previous threads:
Code:
egen dd=group(treat policy2) // that way it can indicate what's pretreatment and what's pos treatment then I apply it in over rifhdreg scores treat##i.policy2##i.black $xvar, rif(q(50)) over(dd) abs(stateid) vce(cluster stateid) rwlogit($xvar) trim(0.01,0.98) att then I get the error message: "More than 2 groups detected. Only 2 groups allowed for the estimator"
My questions:
QUESTION #1: How is reweighting calculated? I know it uses IPW but if I don't indicate the time before and after, it will calculate the weights of treated x untreated during all the period, isn't it so? How do I know that weighting is done only at pre-treatment period? I understand that trimming does the common support, but how is it being done? If not, should I adjust my variable? Sorry if I'm missing something here, in fact, I just want to make sure that my design is correct.
QUESTION #2: How do I know how many observations from my sample are being considered ? Because the other thing is that I notice after reweighting most of my estimates are not significant. I'm practically working with the entire population (N=10 MM) and I find strange those large CIs. It could be because of the previous problem or else, could it be because I'm using a triple interaction? This is happening to nearly all the variables I use mostly for triple interactions but also some single interactions as well. I notice the more controls I use, the larger the CIs, which makes sense but is there a way to know the best variables to consider?
Anyway, the graph below illustrates this problem and still considering the triple interaction. Here is my code:
Code:
qui rifhdreg scores treat##i.policy2##i.black $xvar, rif(q(50)) over(treat) abs(stateid) vce(cluster stateid) rwlogit($xvar) trim(0.01,0.98) att qregplot 1.treat#1.policy , q(5(5)95) ols raopt( color(black%5))
From the graph above I can say that the effects for blacks was only positive for higher quantiles. That also makes sense, but still striking that CIs are so large for the amount of data I have. Unfortunately, I cannot run QREG or BSQREG with my data (I can only do that without covariates) to compare. Of course, I'm aware that it wouldn't give me the effects on the whole distribution which I am interested at considering my outcome variable is a relative rank.
QUESTION #3: bootstraps: due to the size of my dataset (N= 10 MM), I can't calculate use bootstraps to calculate my SEs is it possible to identify QTE just by clustering my errors? Is there another way of doing it with large datasets?
QUESTION #4: Suppose only the double interaction, as code below, I'm a bit confused about robustness checks for identifying QTE. Could anyone help me with that?
Code:
qui rifhdreg scores treat##i.policy2 $xvar, rif(q(50)) over(treat) abs(stateid) vce(cluster stateid) rwlogit($xvar) trim(0.01,0.98) att
Thanks a lot for the help!
Sandra

Comment