Skip to content

normalized condition number #2378

Open
Open

Description

@josef-pkt

We report the condition number in RegressionResults as ratio of largest to smallest eigenvalue of exog.

Greene 5th edt, page 57 mentions sqrt with exog standardized to have unit length, refering to Belsley Kuh and Welsh. This sounds like the usual thresholds are for standardized exog, not the actual exog.

related to other measures for multicollinearity
Check whether we should add normalized condition number.

see also #553 about choosing a threshold

Activity

  1. josef-pkt commented on Oct 28, 2016

    @josef-pkt
    MemberAuthor

    related question: high condition number because of scaling and not because of multicollinearity
    http://stats.stackexchange.com/questions/243000/cause-of-a-high-condition-number-in-a-python-statsmodels-regression

    >>> np.linalg.cond([[100000, 0], [0, 1]])
    100000.0
    
    >>> np.linalg.cond([[1e20, 0], [0, 1]])
    1e+20
    >>> np.linalg.inv([[1e20, 0], [0, 1]])
    array([[  1.00000000e-20,   0.00000000e+00],
           [  0.00000000e+00,   1.00000000e+00]])
    >>> np.linalg.inv([[1e20, 0.5], [0.5, 1]])
    array([[  1.00000000e-20,  -5.00000000e-21],
           [ -5.00000000e-21,   1.00000000e+00]])
    
    

    maybe something like this to illustrate numerical problems

    small correlation (small scaled cond), but bad scaling (large unscaled cond)

    >>> Z = np.array([[1e20, 1e7], [1e7, 1]])
    >>> Z / np.outer(np.sqrt(np.diag(Z)), np.sqrt(np.diag(Z)))
    array([[ 1.   ,  0.001],
           [ 0.001,  1.   ]])
    >>> np.linalg.cond(Z / np.outer(np.sqrt(np.diag(Z)), np.sqrt(np.diag(Z))))
    1.0020020020020017
    
    >>> np.linalg.inv(Z)
    array([[  1.00000100e-20,  -1.00000100e-13],
           [ -1.00000100e-13,   1.00000100e+00]])
    >>> np.linalg.pinv(Z)
    array([[  1.00000000e-20,   1.00000000e-33],
           [  1.00000000e-33,   1.00000000e-46]])
    >>> np.linalg.cond(Z)
    1.0000010000010001e+20
    
  2. added this to the 0.9 milestone on Oct 28, 2016
  3. josef-pkt commented on Oct 28, 2016

    @josef-pkt
    MemberAuthor

    I think we can use this to separate scaling from multicollinearity issues. Threshold for scaling should be higher, threshold for scaled condition number for multicollinearity should be lower.

  4. removed this from the 0.9 milestone on Apr 2, 2021
  5. added this to the 0.15 milestone on Nov 20, 2023
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