Skip to content

multicollinearity warning too sensitive? #553

Open

Description

@jseabold

I've yet to run a regression in the last week where I don't get this warning.

dta = pandas.read_csv("http://www.stat.ufl.edu/~aa/social/csv_files/statewide-crime-2.csv")
dta = dta.set_index("State", inplace=True).dropna()
dta.rename(columns={"VR" : "crime",
                    "MR" : "murder",
                    "M"  : "pctmetro",
                    "W"  : "pctwhite",
                    "H"  : "pcths",
                    "P"  : "poverty",
                    "S"  : "single"
                    }, inplace=True)

from statsmodels.formula.api import ols

mod = ols("murder ~ pctmetro + poverty + pcths + single", data=dta).fit()
print mod.summary()

Activity

  1. josef-pkt commented on Jul 28, 2014

    @josef-pkt
    Member

    another case, fitting a trending variable to another trending variable, (kind of badly scaled)
    from #1847

    import statsmodels.api as sm
    import numpy as np
    data = sm.datasets.cancer.load()
    model = sm.emplike.ELOriginRegress(data.endog, data.exog)
    fitted = model.fit()
    
    >>> res_ols = fitted.model.fit()
    >>> print res_ols.summary()
                                OLS Regression Results                            
    ==============================================================================
    Dep. Variable:                      y   R-squared:                       0.935
    Model:                            OLS   Adj. R-squared:                  0.935
    Method:                 Least Squares   F-statistic:                     4315.
    Date:                Mon, 28 Jul 2014   Prob (F-statistic):          1.04e-179
    Time:                        17:49:55   Log-Likelihood:                -1198.1
    No. Observations:                 301   AIC:                             2400.
    Df Residuals:                     299   BIC:                             2408.
    Df Model:                           1                                         
    Covariance Type:            nonrobust                                         
    ==============================================================================
                     coef    std err          t      P>|t|      [95.0% Conf. Int.]
    ------------------------------------------------------------------------------
    const         -0.5261      0.969     -0.543      0.588        -2.433     1.381
    x1             0.0036   5.45e-05     65.686      0.000         0.003     0.004
    ==============================================================================
    Omnibus:                       67.515   Durbin-Watson:                   1.822
    Prob(Omnibus):                  0.000   Jarque-Bera (JB):             1431.216
    Skew:                           0.040   Prob(JB):                    1.64e-311
    Kurtosis:                      13.682   Cond. No.                     2.30e+04
    ==============================================================================
    
    Warnings:
    [1] Standard Errors assume that the covariance matrix of the errors is correctly specified.
    [2] The condition number is large, 2.3e+04. This might indicate that there are
    strong multicollinearity or other numerical problems.
    
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

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions