spreg.dgp.dgp_slx

spreg.dgp.dgp_slx(u, xb, wxg, ybin=False)[source]

dgp_slx: generates y for SLX with given xb, wxg, and error term u

Examples

>>> import numpy as np
>>> import libpysal
>>> from spreg import make_x, make_xb, make_wx, make_wxg, dgp_slx
>>> rng = np.random.default_rng(12345)
>>> u = make_x(rng,25,mu=[0],varu=[1], method='normal')
>>> x = make_x(rng,25,mu=[0],varu=[1])
>>> xb = make_xb(x,[1,2])
>>> w  = libpysal.weights.lat2W(5, 5)
>>> w.transform = "r"
>>> wx = make_wx(x,w)
>>> wxg = make_wxg(wx,[2])
>>> dgp_slx(u, xb, wxg)[0:5,:]
array([[8.85854389],
       [7.17524694],
       [3.83674621],
       [4.73103929],
       [8.37023076]])