spreg.dgp.make_wx

spreg.dgp.make_wx(x, w, o=1)[source]

make_wx: generate a matrix spatially lagged x given matrix x

x must be previously generated using make_x, no constant included

Examples

>>> import numpy as np
>>> import libpysal
>>> from spreg import make_x, make_wx
>>> rng = np.random.default_rng(12345)
>>> x = make_x(rng,25,mu=[0],varu=[1])
>>> w  = libpysal.weights.lat2W(5, 5)
>>> w.transform = "r"
>>> make_wx(x,w)[0:5,:]
array([[1.12509217],
       [1.87409079],
       [1.36225472],
       [2.1491645 ],
       [2.80255786]])