dmsul / econtools

Econometrics and data manipulation functions.
http://www.danielmsullivan.com/econtools
BSD 3-Clause "New" or "Revised" License
110 stars 24 forks source link

get NaN value for standard error during calculating fixed effects #5

Closed jansonleeljs closed 2 years ago

jansonleeljs commented 3 years ago

Hello,

Thanks for your econtools, it help me a lot in my work. Today I'm calculating the fixed effects by using OLS regression with robust errors. Yet I confront with warning

c:\program files\python37\lib\site-packages\econtools\metrics\core.py:203: RuntimeWarning: invalid value encountered in sqrt
  se = pd.Series(np.sqrt(np.diagonal(vce)), index=vce.columns)

In addition to the warning, all the se estimators of these fixed effects (dummy) variables become NaN.

                   coeff  se   t  p>t  CI_low  CI_high
dummy_0    96.0 NaN NaN  NaN     NaN      NaN
dummy_1   128.0 NaN NaN  NaN     NaN      NaN
dummy_2   144.0 NaN NaN  NaN     NaN      NaN
dummy_3   128.0 NaN NaN  NaN     NaN      NaN

I wonder whether this is due to the problem of colinearity. I appreciate it if you can help diagnose my problem. Thanks a lot.

dmsul commented 2 years ago

Yes, this is likely due to colinearity. Try the check_colinear option.