borusyak / did_imputation

Event studies: robust and efficient estimation, testing, and plotting
GNU General Public License v3.0
159 stars 69 forks source link

Frequency weights not working #2

Open Magna24 opened 3 years ago

Magna24 commented 3 years ago

Dear Kirill,

Thanks for this command, it's already quite great!

I'm having trouble using fweights in a repeated cross-section. Because I have lots of individuals with the same observables, I usually collapse them and save the frequencies to use as fweights and speed up estimation. When I try to use them with did_imputation (downloaded from ssc) I get the following error:

may not use noninteger frequency weights r(401);

I have made sure that I am using integer values (even generating the weight variable as int), but the problem persists. reghdfe should already be updated to the latest version.

I also created a small dataset with code to show the problem that you can find attached. Notice that I am trying to follow the help file recommendations for repeated cross-sections.

Thanks for any help you may be able to offer! Best, Matteo Magnaricotte

fake data.xlsx fake data did_imputation.txt

borusyak commented 3 years ago

Dear Matteo, Thanks for reporting the issue; I think I know what's going on but I'll look at your example. For now, please use aweights instead. In principle fw and aw should differ in SE (and only in SE), but right now only the aweights-like SE are computed anyway. I'll add this to the to-do list for the next version.

Best, Kirill

Magna24 commented 3 years ago

Thanks Kirill! I'll be testing the command some more in the next days, and I'll let you know if I find something else (I can't really use mata, but I'd be happy to help if possible).

Your answer also made me think that since those observations are inside clusters, the resulting standard errors are less likely to differ between the two types of weights.

Thanks again! Matteo