Closed MatthieuStigler closed 3 years ago
Hi Matthieu,
Thanks for the message. I think your intuition is correct that, in your case, the warning messages are due to "too many covariates". What is happening here is a violation of the overlap condition, that for all treated units we can find "matching" untreated units with the same characteristics. For us, this often shows up when group sizes are small (hence the warning that you got), but your case seems to be a different sort of the same violation.
For the part about dealing with time-varying covariates, our code takes the value of the covariate in the "baseline period". In post treatment time periods, the baseline period is the one right before the group becomes treated. In pre-treatment periods, it is the period immediately before the current period.
Hope this helps!
Brant
Great, thanks for the explanation! To be sure, this "overlap ciolation" should in theory only happen only with discrete/factor co variates, is that correct?
Not really. What is going on here is that, sometimes, either we have "too many covariates" such that one can not invert the design matrix. This can be true with discrete or continuous covariates. Other cases we can perfectly predict treatment, which is also problematic.
Hope this clarifies. Pedro
Hi
Thanks a lot for the great package, this is very useful!
We are facing repeated issues when running
did::att_gt
with a discrete covariate, leading to warnings like: Not enough control units for group 1936 in time period 1917 to run specified regression (see regexp below). Would you kindly help us get intuition on what the specific problem is? It seems it is more about having too many covariate factors rather than too few units?My understanding is that in the period-by-period diff-diff, this happens whenever factors of a discrete variable are unbalanced between the treatment and control group, meaning one factor might occur only in the treatment group? I take it from seeing that you run
rcond(t(control_covs)%*%control_covs)
on the control group, which would return 0 in the case a factor was found in the treatment (and hence expanded into columns bymodel.matrix()
) , yet not in the control (column is then 0)? Intuitively I thought this would not be an issue for the period-by-period estimation, though I realize I don't fully understand how you are transforming the panel model with time-varying covariates into a model with pre-treatment covariates to be used byDRDID::reg_did_panel
? Could you kindly elaborate on this?Thanks!
Code:
Created on 2021-03-30 by the reprex package (v1.0.0)