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.
I guess there should be some error handling in the package -- I also
tried to make the numerical check stricter to reach the alternative code
branch, but this just lead to a collinearity problem down the road
within ivpanel.
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.
(BTW: matrix_tsls is another example of duplication between commands
--tsls-- and a wanted function-style interface. Or to put it
differently: maybe this would be something as a public thing for
'extra'? But that's a different topic.)
thanks
sven