Skip to content

singular exog - check #146

Open
Open

Description

@josef-pkt

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.

Activity

  1. jseabold commented on Aug 6, 2012

    @jseabold
    Member

    Brought up again in the mailing list thread "Regression with Singular Exogenous Variable Matrix"

  2. added this to the 0.8 milestone on Apr 5, 2015
  3. josef-pkt commented on Apr 5, 2015

    @josef-pkt
    MemberAuthor

    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

  4. josef-pkt commented on Aug 17, 2016

    @josef-pkt
    MemberAuthor

    PR #3099 changed generic hessian inversion in base to use eigenvalue decomposition and warns if not positive definite

  5. modified the milestones: 0.9, 0.8 on Aug 17, 2016
  6. modified the milestones: 0.9, Someday on Mar 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions