bayespecon.dgp.simulate_sar¶
-
bayespecon.dgp.simulate_sar(n=
None, W=None, gdf=None, rho=0.5, beta=None, sigma=1.0, err_hetero=False, rng=None, seed=None, contiguity='queen', create_gdf=False, geometry_type='polygon')[source]¶ Simulate data from SAR DGP
y = (I-rho W)^(-1)(X beta + eps).- Parameters:¶
- n : int, optional¶
Square-grid side length used when only
nis supplied. This generatesn * nobservations on ann x nrook grid. WhenWorgdfis provided,n(if provided) must match the implied number of observations.- W : Graph or sparse/dense matrix, optional¶
Spatial weights. If supplied, takes precedence over
gdf.- gdf : geopandas.GeoDataFrame, optional¶
Spatial units source used when
Wis not provided.- rho : float, default=0.5¶
Spatial autoregressive coefficient.
- beta : np.ndarray, optional¶
Regression coefficients including intercept.
- sigma : float, default=1.0¶
Innovation standard deviation.
- err_hetero : bool, default=False¶
If True, generate heteroskedastic innovations with observation-specific standard deviations \(\sigma_i = \sigma \sqrt{1 + \|x_i\|^2}\).
- rng : np.random.Generator, optional¶
Random generator.
- seed : int, optional¶
Seed used when
rngis not supplied.- contiguity : str, default="queen"¶
Neighbor rule for
gdfmode.- create_gdf : bool, default=False¶
If True, include a
gdfkey in the returned dict withyandX_*columns attached to geometry.- geometry_type : {"point", "polygon"}, default="polygon"¶
Geometry type to generate when
create_gdf=Trueandgdfis not provided.
- Returns:¶
Keys:
y,X,W_dense,W_graph,params_true.- Return type:¶