neighbayes.dgp.simulate_sar_logit¶
-
neighbayes.dgp.simulate_sar_logit(W=
None, gdf=None, n_side=None, rho=0.35, beta=None, err_hetero=False, rng=None, seed=None, contiguity='queen', create_gdf=False, geometry_type='polygon', latent=True, *, unit_effects=None)[source]¶ Simulate SAR-logit binary outcome data.
DGP¶
The latent SAR the unmarked
SARLogitfits,y* = (I - rho W)^{-1} (X beta + eps),epsiid standard logistic,y = 1(y* > 0). Withlatent=False, the reduced formSARLogit(latent=False)fits:eta = (I - rho W)^{-1} X beta,y ~ Bernoulli(logit^{-1}(eta)).- param W:
Spatial unit structure. If
Wis provided it takes precedence; otherwisegdfis used withcontiguity.- param gdf:
Spatial unit structure. If
Wis provided it takes precedence; otherwisegdfis used withcontiguity.- param n_side:
Side length of the square rook grid used when neither
Wnorgdfis supplied (n_side**2units).- type n_side:
int, optional
- param rho:
Spatial autoregressive parameter.
- type rho:
float, default=0.35
- param beta:
Coefficients including intercept. Defaults to
[0.3, 1.0].- type beta:
np.ndarray, optional
- param err_hetero:
Scale each latent SAR disturbance by
sqrt(1 + ||x_i||^2), a heteroskedastic departure from the model (latent=Trueonly).- type err_hetero:
bool, default False
- param rng:
Random state controls.
- param seed:
Random state controls.
- param contiguity:
GeoDataFrame neighbor rule when
Wis omitted.- type contiguity:
str, default=”queen”
- param create_gdf:
If
True(or a sourcegdfis supplied), return a GeoDataFrame carryingyandX_*columns instead of the dict, matching the other cross-sectional simulators.- type create_gdf:
bool, default=False
- param geometry_type:
Geometry to generate when
create_gdf=Trueand no sourcegdfis provided.- type geometry_type:
{“point”, “polygon”}, default=”polygon”
- param latent:
The latent SAR, whose
eta_trueis the latent utilityy*;Falsedraws the reduced form, whoseeta_trueis the linear predictor.- type latent:
bool, default=True
- returns:
Dict with keys
y,X,W_sparse,W_graph,eta_true,params_true. Whencreate_gdf=True(or a sourcegdfis supplied) a GeoDataFrame withyandX_*columns is returned instead.- rtype:
dict or geopandas.GeoDataFrame