You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure anymore what the behavior with singular (reduced rank) exog matrices is. Needs some investigation (again).
for OLS or linear model:
I'd like to warn and add a comment in summary, but I don't want to kill it and create warning noise. Some of the diagnostic tests don't care about singular exog, since they just need the rsquared or a joint test. df_resid (?) uses rank, so this works also with reduced rank.
(example is when dummy or constant is squared and added as additional variable)
What's the effect of using pinv (and bounding smallest eigenvalue away from zero) on the cov_params ? Can we still detect singular exog ex post (df_resid), or should we check and warn in fit?
related: Until we replace pinv with svd or similar we have redundant calculations to check singularity, eigenvalues and rank.
Similar question for discrete models and GLM.
I tried a Probit example with current master with a duplicated column and neither Probit nor GLM with method='hessian' fail. However, in this Probit example the bse differ (need a different example because there was some disagreement in the hessian calculation between Probit and GLM(probit))
looks like there is a pinv(-hessian) in GLM, not sure about Probit.
correction: I just realized that I have statsmodels 0.6.1 on the python path, instead of the inplace version. GLM().fit(method='xxx') method keyword is silently swallowed and ignored in 0.6.1, method is allways IRLS
edit
back to as expected using master:
GLM irls uses pinv(-hessian), GLM newton use inv(hessian). The latter doesn't raise an exception but has negative diagonal elements (smallest eigenvalue of negative hessian is -1.9e-15 (should be positive), bse has 2 nans in this case.
estimate with method='bfgs' doesn't have negative/nan bse, but bse of collinear variables is 2e7
Activity
jseabold commentedon Aug 6, 2012
Brought up again in the mailing list thread "Regression with Singular Exogenous Variable Matrix"
josef-pkt commentedon Apr 5, 2015
Similar question for discrete models and GLM.
I tried a Probit example with current master with a duplicated column and neither Probit nor GLM with method='hessian' fail. However, in this Probit example the bse differ (need a different example because there was some disagreement in the hessian calculation between Probit and GLM(probit))
looks like there is a
pinv(-hessian)in GLM, not sure about Probit.correction: I just realized that I have statsmodels 0.6.1 on the python path, instead of the inplace version.
GLM().fit(method='xxx')method keyword is silently swallowed and ignored in 0.6.1, method is allways IRLSedit
back to as expected using master:
GLM irls uses pinv(-hessian), GLM newton use
inv(hessian). The latter doesn't raise an exception but has negative diagonal elements (smallest eigenvalue of negative hessian is -1.9e-15 (should be positive), bse has 2 nans in this case.estimate with
method='bfgs'doesn't have negative/nan bse, but bse of collinear variables is 2e7josef-pkt commentedon Aug 17, 2016
PR #3099 changed generic hessian inversion in base to use eigenvalue decomposition and warns if not positive definite