spreg.condition_index

spreg.condition_index(reg)[source]

Calculates the multicollinearity condition index according to Belsey, Kuh and Welsh (1980) [BKW05].

Parameters:
regregression object

output instance from a regression model

Returns:
ci_resultfloat

scalar value for the multicollinearity condition index.

Examples

>>> import numpy as np
>>> import libpysal
>>> from libpysal import examples
>>> import spreg
>>> from spreg import OLS

Read the DBF associated with the Columbus data.

>>> db = libpysal.io.open(examples.get_path("columbus.dbf"),"r")

Create the dependent variable vector.

>>> y = np.array(db.by_col("CRIME"))
>>> y = np.reshape(y, (49,1))

Create the matrix of independent variables.

>>> X = []
>>> X.append(db.by_col("INC"))
>>> X.append(db.by_col("HOVAL"))
>>> X = np.array(X).T

Run an OLS regression.

>>> reg = OLS(y,X)

Calculate the condition index to check for multicollinearity.

>>> testresult = spreg.condition_index(reg)

Print the result.

>>> print("%1.3f"%testresult)
6.542