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 SARLogit fits, y* = (I - rho W)^{-1} (X beta + eps), eps iid standard logistic, y = 1(y* > 0). With latent=False, the reduced form SARLogit(latent=False) fits: eta = (I - rho W)^{-1} X beta, y ~ Bernoulli(logit^{-1}(eta)).

param W:

Spatial unit structure. If W is provided it takes precedence; otherwise gdf is used with contiguity.

param gdf:

Spatial unit structure. If W is provided it takes precedence; otherwise gdf is used with contiguity.

param n_side:

Side length of the square rook grid used when neither W nor gdf is supplied (n_side**2 units).

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=True only).

type err_hetero:

bool, default False

param rng:

Random state controls.

param seed:

Random state controls.

param contiguity:

GeoDataFrame neighbor rule when W is omitted.

type contiguity:

str, default=”queen”

param create_gdf:

If True (or a source gdf is supplied), return a GeoDataFrame carrying y and X_* 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=True and no source gdf is provided.

type geometry_type:

{“point”, “polygon”}, default=”polygon”

param latent:

The latent SAR, whose eta_true is the latent utility y*; False draws the reduced form, whose eta_true is the linear predictor.

type latent:

bool, default=True

returns:

Dict with keys y, X, W_sparse, W_graph, eta_true, params_true. When create_gdf=True (or a source gdf is supplied) a GeoDataFrame with y and X_* columns is returned instead.

rtype:

dict or geopandas.GeoDataFrame