spreg.dgp.dgp_gns¶
- spreg.dgp.dgp_gns(u, xb, wxg, w, rho=0.5, lam=0.2, model='sar', imethod='power_exp', ybin=False)[source]¶
- dgp_gns: generates y for general nested model with sar or ma errors
with xb, wxg, 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, make_wx, make_wxg, dgp_gns >>> 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_gns(u,xb,wxg,w)[0:5,:] array([[18.04158549], [14.96336153], [11.95902806], [12.44108728], [15.47860632]])