insongkim / wfe

20 stars 4 forks source link

Errors in standard error of estimate and student's t test #2

Open MrZhihao opened 5 years ago

MrZhihao commented 5 years ago

Hello,

When I used "wfe" package to figure out some DID question, there were some errors appeared. The results of Std.Err, t value and Pr displayed "NA" and there was a warning message-"Warning message: In sqrt(diag(vcov.wfe)) : NaNs produced".

Could someone please help me find the way to deal with these errors? Thanks a lot!

PS: the number of the data I used seems a little bit large and it's over 40,000 items.

insongkim commented 5 years ago

Thank you very much for using the package. Could you check whether there is at least one treated and control observation within each unit and time? Another reason why this could happen is when there exists perfect collinearity. Could you check whether one of the covariates in your model is a linear combination of others?

MrZhihao commented 5 years ago

Thank you for your answer. I guess these errors may be because there is not treated observation in some units.

However, I still have a question that why we should ensure that each unit in the control group have at least one item treated.

Looking forward to your further response. Thx again!

insongkim commented 5 years ago

Thanks. It is not necessarily a problem. However, if there exist variables that also don't vary within the unit, then I think the perfect collinearity issue arises. Thus, in general, we recommend users to ensure that there are no time-invariant covariates.

MrZhihao commented 5 years ago

I'm a little confused. Actually in my case, there are some units that just have all 0 treatment variate. And I could ensure that except treatment variate, covariates are all time-invariant.

insongkim commented 5 years ago

Could you send me the code/data so that I can reproduce your error? I will look into it. Thanks.

MrZhihao commented 5 years ago

It's great. My code is as follow: modSingle.did <- wfe(Vol~ Treat+TrancPortion+MovPortion, data = finalPriceData, treat = "Treat", unit.index = "Stkcd", time.index = "Trddt", method = "unit", qoi = "ate", estimator ="did", hetero.se=TRUE, auto.se=TRUE, White = TRUE, White.alpha = 0.05, verbose = TRUE)

But the data is over 2MB, could you give me your email or other way so that I could send it?

Thanks for your help.

insongkim commented 5 years ago

@Deo-Ned please send the files to insong@mit.edu Thanks.