rsaggio87 / LeaveOutTwoWay

Bias corrected estimates of variance components in two fixed effects models as described in Kline, Saggio and Sølvsten (2020)
24 stars 11 forks source link

Leave_out_KSS: function -ichol()- fails #23

Closed elyubich closed 3 years ago

elyubich commented 3 years ago

Thank you so much for making this code available, and for the really helpful vignette. I'm running into a surprising issue I was wondering if you could help me with.

When I download the directory from github exactly as is and try to run leave_out_KSS(y,id,firmid) with data/test.csv, I get the following warnings in Section 2:

USER WARNING: function -ichol()- with diagcomp = 0.1 failed! USER WARNING: function -ichol()- did not execute successfully for any value of diagcomp <= 0.1

and then the pcg function (line 540 in leave_out_KSS) doesn't converge and the reported estimates end up different from those in the vignette.

I've been tracing the error back, and so far my understanding is that the problem is appearing when leave_out_KSS calls lchol_iter at line 536, which fails the try loop and outputs Lchol=[]. It looks like within the function, sum(abs(xx),2)./diag(xx) returns a vector of 2s, and that makes diagcomp_max=0, and diagcomp_list = [.1]. Do you have any idea of what could be going on, or why the code would run differently on my computer than yours?

rsaggio87 commented 3 years ago

Hi @elyubich,

Thank you so much for letting me know. The problem is due to the fact that I (very stupidly!) did not define "droptol" inside the function "lchol_iter" which was added following the discussion in Issue #17. The code was then saying that ichol was failing but that was simply because droptol was not defined, not because of any deficiency in the matrix xx.

If you check https://github.com/rsaggio87/LeaveOutTwoWay/tree/fixing_Lchol, the issue should be resolved

elyubich commented 3 years ago

Thanks so much!