spreg.dgp.dgp_lagerr

spreg.dgp.dgp_lagerr(u, xb, w, rho=0.5, lam=0.2, model='sar', imethod='power_exp', ybin=False)[source]
dgp_lagerr: generates y for spatial lag model with sar or ma errors

with xb, weights, spatial parameter rho, spatial parameter lambda, model for spatial process, error term, method for inverse transform

Examples

>>> import numpy as np
>>> import libpysal
>>> from spreg import make_x, make_xb, dgp_lagerr
>>> 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_lagerr(u, xb, w)[0:5,:]
array([[10.13845523],
       [ 7.53009531],
       [ 5.40644034],
       [ 5.51132886],
       [ 8.58872366]])