spreg.se_betas

spreg.se_betas(reg)[source]

Calculates the standard error of the regression coefficients. [Gre03]

Parameters:
regregression object

output instance from a regression model

Returns:
se_resultarray

includes standard errors of each coefficient (1 x k)

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 standard errors of the regression coefficients.

>>> testresult = spreg.se_betas(reg)

Print the vector of standard errors.

>>> testresult
array([4.73548613, 0.33413076, 0.10319868])