spreg.dgp.dgp_lag

spreg.dgp.dgp_lag(u, xb, w, rho=0.5, imethod='power_exp', ybin=False)[source]
dgp_lag: generates y for spatial lag model with xb, weights,

spatial parameter rho, error term, method for inverse transform

Examples

>>> import numpy as np
>>> import libpysal
>>> from spreg import make_x, make_xb, dgp_lag
>>> 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"
>>> dgp_lag(u, xb, w)[0:5,:]
array([[10.16582326],
       [ 7.75359864],
       [ 5.39821733],
       [ 5.62244672],
       [ 8.868168  ]])