spreg.dgp.make_wxg¶
- spreg.dgp.make_wxg(wx, gamma)[source]¶
- make_wxg: generate a column wxg as matrix wx (no constant)
times list gamma (coefficient of spatially lagged x)
Examples
>>> import numpy as np >>> import libpysal >>> from spreg import make_x, make_wx, make_wxg >>> rng = np.random.default_rng(12345) >>> x = make_x(rng,25,mu=[0],varu=[1]) >>> w = libpysal.weights.lat2W(5, 5) >>> w.transform = "r" >>> wx = make_wx(x,w) >>> print(wx.shape) (25, 1) >>> make_wxg(wx,[2,4])[0:5,:] array([[ 2.25018434, 4.50036868], [ 3.74818158, 7.49636316], [ 2.72450944, 5.44901889], [ 4.298329 , 8.59665799], [ 5.60511572, 11.21023145]])