xuyiqing / fect

fixed effect counterfactual estimators
Other
53 stars 20 forks source link

Errors: cannot use all pre-periods in F test / covariance matrix is irreversible #39

Closed nthrpy closed 3 months ago

nthrpy commented 3 months ago

Dear Prof. Xu-

I encountered the following errors often when using ife:

Cannot use full pre-treatment periods in the F test. The first period is removed. The estimated covariance matrix is irreversible.

Here is the simulated time-series and also the fect parameters: image image

Why do these errors occur? How do I avoid them?

Thank you!

lzy318 commented 3 months ago

This is because the number of treated units is smaller than the number of pre-treatment periods, so it can't implement the F-test for all pre-treatment periods. However, you can specify a shorter pre-treatment periods for testing, e.g., add the option pre.periods = c(-3,0) to test for the pretrend in the last 4 pre-treatment periods.

nthrpy commented 3 months ago

Your recommendation solves the problem. Thank you!