Code
import numpy as np
import libpysal
import spreg
import numpy as np
import libpysal
import spreg
= libpysal.io.open(libpysal.examples.get_path("columbus.dbf"),'r') db
= np.array(db.by_col("HOVAL"))
y = np.reshape(y, (49,1)) y
= []
X "INC"))
X.append(db.by_col("CRIME"))
X.append(db.by_col(= np.array(X).T X
= libpysal.weights.Rook.from_shapefile(libpysal.examples.get_path("columbus.shp")) w
= 'r' w.transform
from spreg import GM_Lag
=True) #prevent scientific format
np.set_printoptions(suppress=GM_Lag(y, X, w=w, w_lags=2, name_x=['inc', 'crime'], name_y='hoval', name_ds='columbus')
reg
reg.betas45.30170561],
np.array([[0.62088862],
[ -0.48072345],
[0.02836221]]) [
array([[45.30170561],
[ 0.62088862],
[-0.48072345],
[ 0.02836221]])
:::