spreg.diagnostics.schwarz¶
-
spreg.diagnostics.
schwarz
(reg)[source]¶ Calculates the Schwarz Information Criterion. [S+78]
- Parameters
- regregression object
output instance from a regression model
- Returns
- bic_resultscalar
value for Schwarz (Bayesian) Information Criterion of the regression.
Examples
>>> import numpy as np >>> import libpysal >>> from libpysal import examples >>> import diagnostics >>> from ols 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 Schwarz Information Criterion.
>>> testresult = diagnostics.schwarz(reg)
Print the results.
>>> testresult 386.42993851863008