spreg.dgp.dgp_sperror¶
- spreg.dgp.dgp_sperror(u, xb, w, lam=0.5, model='sar', imethod='power_exp', ybin=False)[source]¶
- dgp_sperror: generates y for spatial error model with given xb, weights,
spatial parameter lam, error term, method for inverse transform
Examples
>>> import numpy as np >>> import libpysal >>> from spreg import make_x, make_xb, dgp_sperror >>> 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_sperror(u, xb, w)[0:5,:] array([[5.21425813], [3.03696553], [1.12192347], [1.15756751], [4.42322667]])