On Mon, 15 Feb 2021, Sven Schreiber wrote:
Hi,
I'm getting a matrix non-pos-def error when using the ivpanel addon. It
concerns the function matrix_tsls, namely:
matrix nonzero = (abs(R[diag]) .> 1.0e-12)'
if minr(nonzero) == 1
V = invpd(XQ * XQ')
where R is from a QR decomposition. I've checked R, and indeed there is
one value just slightly above (in abs) 1e-12, it's -1.4099e-012. Then
the smallest eigenvalue of XQ*XQ' comes in slightly negative at
-4.8615e-011 which explains the error. [...]
So the solution is apparently: remove the same regressors that Jack's
felogit package removes automatically as (numerically) collinear. At
least it works in my case. Perhaps the relevant code could be moved to
ivpanel, because it is an addon, and then felogit could depend on it for
that check.
I agree, ivpanel should use the same approach as felogit on this
point. But I don't see a need to move the relevant code, since it's
basically just a call to the built-in function dropcoll. That can be
duplicated in ivpanel without substantial redundancy.
Allin