API reference

Cross-Sectional Spatial Models

OLS([formula, data, y, X, W, priors, ...])

Bayesian ordinary least squares cross-sectional regression.

SAR([formula, data, y, X, W, priors, ...])

Bayesian Spatial Autoregressive (Spatial Lag) model.

SEM([formula, data, y, X, W, priors, ...])

Bayesian Spatial Error Model.

SLX([formula, data, y, X, W, priors, ...])

Bayesian SLX (Spatial Lag X) model.

SDM([formula, data, y, X, W, priors, ...])

Bayesian Spatial Durbin Model.

SDEM([formula, data, y, X, W, priors, ...])

Bayesian Spatial Durbin Error Model.

Panel Spatial Models (Fixed Effects)

OLSPanelFE([formula, data, y, X, W, ...])

Bayesian pooled and fixed-effects linear panel regression.

SARPanelFE([formula, data, y, X, W, ...])

Bayesian spatial-lag panel regression.

SEMPanelFE([formula, data, y, X, W, ...])

Bayesian spatial-error panel regression.

SDMPanelFE([formula, data, y, X, W, ...])

Bayesian spatial Durbin panel regression.

SDEMPanelFE([formula, data, y, X, W, ...])

Bayesian spatial Durbin error panel regression.

SLXPanelFE([formula, data, y, X, W, ...])

Bayesian SLX panel regression.

Panel Spatial Models (Random Effects)

OLSPanelRE(**kwargs)

Bayesian random effects panel regression (non-spatial).

SARPanelRE(**kwargs)

Bayesian spatial lag panel model with unit random effects.

SEMPanelRE([mundlak])

Bayesian spatial error panel model with unit random effects.

SDEMPanelRE(**kwargs)

Bayesian spatial Durbin error panel model with unit random effects.

Dynamic Panel Spatial Models

OLSPanelDynamic(*args[, effects])

SDMRPanelDynamic(*args[, effects])

SDMUPanelDynamic(*args[, effects])

SARPanelDynamic(*args[, effects])

SEMPanelDynamic(*args[, effects])

SDEMPanelDynamic(*args[, effects])

SLXPanelDynamic(*args[, effects])

Non-Linear Spatial Models

SARProbit([formula, data, y, X, W, ...])

Bayesian spatial probit with regional random effects.

SARTobit(*args[, censoring])

Bayesian spatial autoregressive Tobit model.

SEMTobit(*args[, censoring])

Bayesian spatial error Tobit model.

SDMTobit(*args[, censoring])

Bayesian spatial Durbin Tobit model.

SARNegBin(*args, **kwargs)

SARNegBinStructural(*args, **kwargs)

Bayesian structural-form SAR-NB with Pólya–Gamma Gibbs sampler.

SARZINB([formula, data, y, X, Z, W, W_sel, ...])

Bayesian zero-inflated SAR Negative Binomial with PG-Gibbs sampler.

Logit(*args, **kwargs)

Bayesian (non-spatial) logistic regression.

NegBin(*args, **kwargs)

Bayesian (non-spatial) Negative Binomial regression.

SARLogit(*args, **kwargs)

Bayesian reduced-form SAR-logit with Pólya–Gamma Gibbs sampler.

SEMLogit(*args, **kwargs)

Bayesian structural-form SEM-logit with Pólya–Gamma Gibbs sampler.

Panel Spatial Models (Tobit)

SARPanelTobit(*args[, censoring])

SEMPanelTobit(*args[, censoring])

Flow Models

OLSFlow(y, X, W, **kwargs)

Non-spatial Bayesian OD-flow gravity model (independence baseline).

SARFlow(y, X, W, **kwargs)

Bayesian SAR flow model with three free spatial autoregressive parameters.

SARFlowSeparable(y, X, W, **kwargs)

Bayesian separable SAR flow model with ρ_w = −ρ_d · ρ_o.

NegBinFlow(y, X, W, **kwargs)

Aspatial OD-flow Negative Binomial gravity baseline.

SARNegBinFlow(y, X, W, **kwargs)

Bayesian SAR flow model with NB2 observation noise.

SARNegBinFlowSeparable(y, X, W, **kwargs)

Separable SAR flow model with NB2 observation noise.

SEMFlow(y, X, W, **kwargs)

Bayesian spatial-error flow model with three free spatial parameters.

SEMFlowSeparable(y, X, W, **kwargs)

Bayesian separable spatial-error flow model with \(\lambda_w = -\lambda_d \lambda_o\).

Panel Flow Models

OLSFlowPanel(y, X, W, T, **kwargs)

Non-spatial Bayesian OD-flow gravity model for balanced panel data.

SARFlowPanel(*args, **kwargs)

Panel spatial-lag origin-destination flow model with unrestricted dependence.

SARFlowSeparablePanel(y, X, W, **kwargs)

Panel separable spatial-lag flow model with \(\rho_w = -\rho_d \rho_o\).

NegBinFlowPanel(y, X, W, T, **kwargs)

Aspatial panel OD-flow NB2 gravity baseline.

SARNegBinFlowPanel(y, X, W, **kwargs)

Panel NB2 SAR flow model with unrestricted dependence parameters.

SARNegBinFlowSeparablePanel(y, X, W, **kwargs)

Panel separable NB2 SAR flow model.

SEMFlowPanel(y, X, W, T, **kwargs)

Panel spatial-error flow model with three free spatial parameters.

SEMFlowSeparablePanel(y, X, W, T, **kwargs)

Panel separable spatial-error flow model with \(\lambda_w = -\lambda_d \lambda_o\).

Default Gibbs Priors

GibbsBasePriors([beta_mu, beta_sigma, ...])

Base priors for all Gibbs samplers.

GaussianGibbsPriors([beta_mu, beta_sigma, ...])

Prior hyperparameters for Gaussian spatial Gibbs.

GibbsPriors([beta_mu, beta_sigma, ...])

Prior hyperparameters for the SAR-NB Gibbs sampler.

ReducedGibbsPriors([beta_mu, beta_sigma, ...])

Prior hyperparameters for the reduced-form SAR-NB sampler.

FlowReducedGibbsPriors([beta_mu, ...])

Prior hyperparameters for the reduced-form flow NB sampler.

ZINBGibbsPriors([gamma_mu, gamma_sigma, ...])

Prior hyperparameters for the ZINB Gibbs sampler.

LogitGibbsPriors([beta_mu, beta_sigma, ...])

Prior hyperparameters for the SAR-logit Gibbs sampler.

SEMLogitGibbsPriors([beta_mu, beta_sigma, ...])

Prior hyperparameters for the SEM-logit Gibbs sampler.

REGibbsPriors([beta_mu, beta_sigma, ...])

Prior hyperparameters for RE panel Gibbs sampler.

PanelGaussianPriors([beta_mu, beta_sigma, ...])

Prior hyperparameters for the Gaussian panel flow Gibbs sampler.

Default NUTS Priors

OLSPriors([beta_mu, beta_sigma, ...])

Priors for neighbayes.models.OLS.

SLXPriors([beta_mu, beta_sigma, ...])

Priors for neighbayes.models.SLX.

SARPriors([beta_mu, beta_sigma, ...])

Priors for neighbayes.models.SAR.

SEMPriors([beta_mu, beta_sigma, ...])

Priors for neighbayes.models.SEM.

SDMPriors([beta_mu, beta_sigma, ...])

Priors for neighbayes.models.SDM (lag + WX).

SDEMPriors([beta_mu, beta_sigma, ...])

Priors for neighbayes.models.SDEM (SLX + spatial error).

NegBinPriors([beta_mu, beta_sigma, ...])

Priors for neighbayes.models.NegBin.

SARNegBinPriors([beta_mu, beta_sigma, ...])

Priors for neighbayes.models.SARNegBin.

SARTobitPriors([beta_mu, beta_sigma, ...])

Priors for neighbayes.models.SARTobit.

SEMTobitPriors([beta_mu, beta_sigma, ...])

Priors for neighbayes.models.SEMTobit.

SDMTobitPriors([beta_mu, beta_sigma, ...])

Priors for neighbayes.models.SDMTobit.

SARProbitPriors([rho_lower, rho_upper, ...])

Priors for neighbayes.models.SARProbit.

SARLogitPriors([rho_lower, rho_upper, ...])

Priors for neighbayes.models.SARLogit.

SEMLogitPriors([lam_lower, lam_upper, ...])

Priors for neighbayes.models.SEMLogit.

PanelBasePriors([beta_mu, beta_sigma, ...])

Priors shared by every panel model.

PanelOLSPriors([beta_mu, beta_sigma, ...])

Priors for neighbayes.models.OLSPanelFE.

PanelSLXPriors([beta_mu, beta_sigma, ...])

Priors for neighbayes.models.SLXPanelFE.

PanelSARPriors([beta_mu, beta_sigma, ...])

Priors for neighbayes.models.SARPanelFE (adds rho bounds).

PanelSEMPriors([beta_mu, beta_sigma, ...])

Priors for neighbayes.models.SEMPanelFE (adds lam bounds).

PanelSDMPriors([beta_mu, beta_sigma, ...])

Priors for neighbayes.models.SDMPanelFE.

PanelSDEMPriors([beta_mu, beta_sigma, ...])

Priors for neighbayes.models.SDEMPanelFE.

PanelOLSREPriors([sigma_alpha_sigma, ...])

Priors for neighbayes.models.OLSPanelRE.

PanelSARREPriors([sigma_alpha_sigma, ...])

Priors for neighbayes.models.SARPanelRE.

PanelSEMREPriors([sigma_alpha_sigma, ...])

Priors for neighbayes.models.SEMPanelRE.

PanelSDEMREPriors([sigma_alpha_sigma, ...])

Priors for neighbayes.models.SDEMPanelRE.

PanelSARTobitPriors([beta_mu, beta_sigma, ...])

Priors for neighbayes.models.SARPanelTobit.

PanelSEMTobitPriors([beta_mu, beta_sigma, ...])

Priors for neighbayes.models.SEMPanelTobit.

PanelDynamicBasePriors([beta_mu, ...])

Priors shared by every dynamic panel model.

PanelOLSDynamicPriors([beta_mu, beta_sigma, ...])

Priors for neighbayes.models.OLSPanelDynamic.

PanelSLXDynamicPriors([beta_mu, beta_sigma, ...])

Priors for neighbayes.models.SLXPanelDynamic.

PanelSARDynamicPriors([beta_mu, beta_sigma, ...])

Priors for neighbayes.models.SARPanelDynamic.

PanelSEMDynamicPriors([beta_mu, beta_sigma, ...])

Priors for neighbayes.models.SEMPanelDynamic.

PanelSDMRDynamicPriors([beta_mu, ...])

Priors for neighbayes.models.SDMRPanelDynamic.

PanelSDMUDynamicPriors([beta_mu, ...])

Priors for neighbayes.models.SDMUPanelDynamic.

PanelSDEMDynamicPriors([beta_mu, ...])

Priors for neighbayes.models.SDEMPanelDynamic.

Bayesian Diagnostics

BayesianLMTestResult(lm_samples, mean, ...)

Container for Bayesian LM test results.

bayesian_lm_lag_test(model)

Bayesian LM test for omitted spatial lag (SAR) model.

bayesian_lm_error_test(model)

Bayesian LM test for omitted spatial error (SEM) model.

bayesian_lm_wx_test(model)

Bayesian LM test for WX coefficients (H₀: γ = 0 | SAR).

bayesian_lm_sdm_joint_test(model)

Bayesian joint LM test for SDM (H₀: ρ = 0 AND γ = 0 | OLS).

bayesian_lm_slx_error_joint_test(model)

Bayesian joint LM test for SDEM (H₀: λ = 0 AND γ = 0 | OLS).

bayesian_lm_error_from_sar_test(model)

Bayesian LM-Error test from a SAR posterior (H₀: λ = 0 | SAR).

bayesian_lm_error_sdm_test(model)

Bayesian LM-Error test from an SDM posterior (H₀: λ = 0 | SDM).

bayesian_lm_lag_sdem_test(model)

Bayesian LM-Lag test from an SDEM posterior (H₀: ρ = 0 | SDEM).

bayesian_lm_wx_sem_test(model)

Bayesian LM test for WX coefficients in SEM (H₀: γ = 0 | SEM).

bayesian_robust_lm_lag_test(model)

Bayesian robust LM-Lag test (H₀: ρ = 0, robust to local λ).

bayesian_robust_lm_error_test(model)

Bayesian robust LM-Error test (H₀: λ = 0, robust to local ρ).

bayesian_robust_lm_lag_sdm_test(model)

Bayesian robust LM-Lag test in SDM context (H₀: ρ = 0, robust to γ).

bayesian_robust_lm_wx_test(model)

Bayesian robust LM-WX test (H₀: γ = 0, robust to ρ).

bayesian_robust_lm_error_sdem_test(model)

Bayesian robust LM-Error test in SDEM context (H₀: λ = 0, robust to γ).

bayesian_robust_lm_error_sar_test(model)

Bayesian robust LM-Error test in SAR context (H₀: λ = 0 | SAR).

bayesian_robust_lm_error_sdm_test(model)

Bayesian robust LM-Error test in SDM context (H₀: λ = 0 | SDM).

bayesian_robust_lm_lag_sdem_test(model)

Bayesian robust LM-Lag test in SDEM context (H₀: ρ = 0 | SDEM).

bayesian_robust_lm_lag_sem_test(model)

Bayesian robust LM-Lag test in SEM context (H₀: ρ = 0 | SEM).

bayesian_robust_lm_wx_sem_test(model)

Bayesian robust LM-WX test in SEM context (H₀: γ = 0 | SEM).

GLM Bayesian LM Tests

Pólya-Gamma augmented LM tests for non-Gaussian models (Logit, NegBin).

bayesian_glm_lm_lag_test(model)

Bayesian LM test for an omitted spatial lag of the linear predictor.

bayesian_glm_lm_error_test(model)

Bayesian LM test for omitted spatial error in a GLM (logit / NB).

bayesian_glm_lm_wx_test(model)

Bayesian LM test for omitted WX coefficients in a GLM (H₀: γ = 0).

Panel Bayesian LM Tests

bayesian_panel_lm_lag_test(model)

Bayesian panel LM test for omitted spatial lag (H₀: ρ = 0).

bayesian_panel_lm_error_test(model)

Bayesian panel LM test for omitted spatial error (H₀: λ = 0).

bayesian_panel_robust_lm_lag_test(model)

Bayesian panel robust LM-Lag test (H₀: ρ = 0, robust to λ).

bayesian_panel_robust_lm_error_test(model)

Bayesian panel robust LM-Error test (H₀: λ = 0, robust to ρ).

bayesian_panel_lm_wx_test(model)

Bayesian panel LM test for WX coefficients (H₀: γ = 0).

bayesian_panel_lm_sdm_joint_test(model)

Bayesian panel joint LM test for SDM (H₀: ρ = 0 AND γ = 0).

bayesian_panel_lm_slx_error_joint_test(model)

Bayesian panel joint LM test for SDEM (H₀: λ = 0 AND γ = 0).

bayesian_panel_lm_error_sdm_test(model)

Panel LM-Error test from an SDM panel posterior (H₀: λ = 0 | SDM).

bayesian_panel_lm_lag_sdem_test(model)

Panel LM-Lag test from an SDEM panel posterior (H₀: ρ = 0 | SDEM).

bayesian_panel_lm_wx_sem_test(model)

Bayesian panel LM test for WX coefficients in SEM (H₀: γ = 0 | SEM).

bayesian_panel_robust_lm_lag_sdm_test(model)

Bayesian panel robust LM-Lag in SDM context (H₀: ρ = 0 | SLX panel).

bayesian_panel_robust_lm_wx_test(model)

Bayesian panel robust LM-WX (H₀: γ = 0 | SAR panel, robust to ρ).

bayesian_panel_robust_lm_error_sdem_test(model)

Bayesian panel robust LM-Error in SDEM context (H₀: λ = 0 | SLX panel).

Flow Bayesian LM Tests

bayesian_lm_flow_dest_test(model)

Bayesian LM test for an omitted destination-side spatial lag.

bayesian_lm_flow_orig_test(model)

Bayesian LM test for an omitted origin-side spatial lag (\(H_0\colon \rho_o = 0\)).

bayesian_lm_flow_network_test(model)

Bayesian LM test for an omitted network spatial lag (\(H_0\colon \rho_w = 0\)).

bayesian_lm_flow_intra_test(model)

Bayesian LM (WX-style) test for the intra block in an OLSFlow null.

bayesian_lm_flow_joint_test(model)

Joint Bayesian LM test for the SARFlow filter (\(H_0\colon \rho_d = \rho_o = \rho_w = 0\)).

bayesian_robust_lm_flow_dest_test(sarflow_model)

Robust Bayesian LM test for \(\rho_d\) adjusting for \((\rho_o, \rho_w)\) nuisance via the Neyman-orthogonal score (Bera and Yoon [1993], Anselin et al. [1996], Doğan et al. [2021]).

bayesian_robust_lm_flow_orig_test(sarflow_model)

Robust Bayesian LM test for \(\rho_o\) adjusting for \((\rho_d, \rho_w)\) nuisance.

bayesian_robust_lm_flow_network_test(...)

Robust Bayesian LM test for \(\rho_w\) adjusting for \((\rho_d, \rho_o)\) nuisance.

bayesian_panel_lm_flow_dest_test(model)

Panel analogue of bayesian_lm_flow_dest_test() operating on a fitted OLSFlowPanel.

bayesian_panel_lm_flow_orig_test(model)

Panel analogue of bayesian_lm_flow_orig_test() (\(H_0\colon \rho_o = 0\)).

bayesian_panel_lm_flow_network_test(model)

Panel analogue of bayesian_lm_flow_network_test() (\(H_0\colon \rho_w = 0\)).

bayesian_panel_lm_flow_intra_test(model)

Panel analogue of bayesian_lm_flow_intra_test() on OLSFlowPanel.

bayesian_panel_lm_flow_joint_test(model)

Panel analogue of bayesian_lm_flow_joint_test() on OLSFlowPanel.

Diagnostic Test Suites

Pre-bundled collections of LM tests used by model.spatial_diagnostics() and the decision-tree renderers.

DiagnosticSuite(name, tests)

Named, immutable registry of Bayesian LM specification tests.

get_diagnostic_suite(model)

Return the DiagnosticSuite for model, or None.

OLS_SUITE

Named, immutable registry of Bayesian LM specification tests.

OLS_PANEL_SUITE

Named, immutable registry of Bayesian LM specification tests.

SAR_SUITE

Named, immutable registry of Bayesian LM specification tests.

SAR_PANEL_SUITE

Named, immutable registry of Bayesian LM specification tests.

SAR_NEGBIN_SUITE

Named, immutable registry of Bayesian LM specification tests.

SAR_TOBIT_SUITE

Named, immutable registry of Bayesian LM specification tests.

SEM_SUITE

Named, immutable registry of Bayesian LM specification tests.

SEM_PANEL_SUITE

Named, immutable registry of Bayesian LM specification tests.

SEM_PANEL_DYNAMIC_SUITE

Named, immutable registry of Bayesian LM specification tests.

SLX_SUITE

Named, immutable registry of Bayesian LM specification tests.

SLX_PANEL_SUITE

Named, immutable registry of Bayesian LM specification tests.

SLX_PANEL_DYNAMIC_SUITE

Named, immutable registry of Bayesian LM specification tests.

SDM_SUITE

Named, immutable registry of Bayesian LM specification tests.

SDM_PANEL_SUITE

Named, immutable registry of Bayesian LM specification tests.

SDM_TOBIT_SUITE

Named, immutable registry of Bayesian LM specification tests.

SDEM_SUITE

Named, immutable registry of Bayesian LM specification tests.

SDEM_PANEL_SUITE

Named, immutable registry of Bayesian LM specification tests.

FLOW_SUITE

Named, immutable registry of Bayesian LM specification tests.

FLOW_INTRA_SUITE

Named, immutable registry of Bayesian LM specification tests.

FLOW_PANEL_SUITE

Named, immutable registry of Bayesian LM specification tests.

LOGIT_SUITE

Named, immutable registry of Bayesian LM specification tests.

NEGBIN_SUITE

Named, immutable registry of Bayesian LM specification tests.

LOGIT_SUITE

Named, immutable registry of Bayesian LM specification tests.

NEGBIN_SUITE

Named, immutable registry of Bayesian LM specification tests.

Bayesian Model Comparison

ModelComparison(models[, labels, method])

Compare a collection of fitted Bayesian models.

bayes_factor_compare_models(models[, ...])

Compute all pairwise Bayes factors for a set of Bayesian models.

MCMC Efficiency

SpatialMCMCReport(parameters, ess_bulk, ...)

Summary of MCMC sampling-efficiency checks for a spatial model.

spatial_mcmc_diagnostic(model, *[, min_ess, ...])

Run MCMC adequacy checks on a fitted Bayesian spatial model.

Spatial Cross-Validation

SpatialCVResult(elpd, se, elpd_per_fold, ...)

Result of spatial_kfold().

spatial_kfold(model, *[, splitter, ...])

Spatial block cross-validation for a fitted Bayesian spatial model.

Data Generating Processes

Note

The cross-sectional and (scalar) panel DGP simulators accept W (Graph/sparse/dense) and gdf inputs. You may provide both together; in that case W is used for simulation and is checked against gdf for dimensional compatibility (a ValueError is raised when they do not describe the same number of spatial units).

The flow DGPs below take G (libpysal Graph), gdf, n, and knn_k instead. All four are optional: when none is supplied the DGP synthesises a point grid via synth_point_geodataframe() and builds a row-standardised KNN graph automatically.

simulate_ols([n, W, gdf, beta, sigma, ...])

Simulate data from a non-spatial OLS DGP y = X beta + eps.

simulate_sar([n, W, gdf, rho, beta, sigma, ...])

Simulate data from SAR DGP y = (I-rho W)^(-1)(X beta + eps).

simulate_sem([n, W, gdf, lam, beta, sigma, ...])

Simulate data from SEM DGP y = X beta + (I-lam W)^(-1) eps.

simulate_slx([n, W, gdf, beta1, beta2, ...])

Simulate data from SLX DGP y = X beta1 + W X_no_intercept beta2 + eps.

simulate_sdm([n, W, gdf, rho, beta1, beta2, ...])

Simulate data from SDM DGP y = (I-rho W)^(-1)(Xb1 + WXb2 + eps).

simulate_sdem([n, W, gdf, lam, beta1, ...])

Simulate data from SDEM DGP y = Xb1 + WXb2 + (I-lam W)^(-1)eps.

simulate_sar_negbin([n, W, gdf, rho, beta, ...])

Simulate data from a SAR-NB2 DGP.

simulate_sar_zinb([n, W, gdf, rho, lam, ...])

Simulate data from a zero-inflated SAR-NB DGP.

simulate_spatial_probit([W, gdf, n, rho, ...])

Simulate SARProbit-style binary outcome data.

simulate_sar_tobit(*[, censoring, err_hetero])

Simulate left-censored SAR Tobit data.

simulate_sem_tobit(*[, censoring, err_hetero])

Simulate left-censored SEM Tobit data.

simulate_sdm_tobit(*[, censoring, err_hetero])

Simulate left-censored SDM Tobit data.

simulate_panel_ols_fe(N, T[, beta, sigma, ...])

Simulate pooled data compatible with OLSPanelFE model assumptions.

simulate_panel_sar_fe(N, T[, rho, beta, ...])

Simulate SAR panel data in time-first stacking order.

simulate_panel_sem_fe(N, T[, lam, beta, ...])

Simulate SEM panel data in time-first stacking order.

simulate_panel_sdm_fe(N, T[, rho, beta1, ...])

Simulate SDM panel FE data.

simulate_panel_sdem_fe(N, T[, lam, beta1, ...])

Simulate SDEM panel FE data.

simulate_panel_slx_fe(N, T[, beta1, beta2, ...])

Simulate SLX panel FE data.

simulate_panel_ols_re(*[, err_hetero])

Simulate OLS random-effects panel style data.

simulate_panel_sar_re(*[, err_hetero])

Simulate SAR random-effects panel style data.

simulate_panel_sem_re(*[, err_hetero])

Simulate SEM random-effects panel style data.

simulate_panel_dlm_fe(N, T[, phi, beta, ...])

Simulate dynamic non-spatial panel FE data.

simulate_panel_sdmr_fe(N, T[, rho, phi, ...])

Simulate dynamic restricted SDM panel FE data.

simulate_panel_sdmu_fe(N, T[, rho, phi, ...])

Simulate dynamic unrestricted SDM panel FE data.

simulate_panel_sar_dynamic_fe(N, T[, rho, ...])

Simulate dynamic SAR panel FE data.

simulate_panel_sem_dynamic_fe(N, T[, lam, ...])

Simulate dynamic SEM panel FE data.

simulate_panel_sdem_dynamic_fe(N, T[, lam, ...])

Simulate dynamic SDEM panel FE data.

simulate_panel_slx_dynamic_fe(N, T[, phi, ...])

Simulate dynamic SLX panel FE data.

simulate_panel_sar_tobit_fe(*[, censoring, ...])

Simulate left-censored panel SAR FE data.

simulate_panel_sem_tobit_fe(*[, censoring, ...])

Simulate left-censored panel SEM FE data.

Flow Data Generating Processes

Each flow DGP accepts n, G, gdf, and knn_k as optional arguments and (unless gamma_dist=0.0) appends a log_distance column log(1 + d_{ij}) with default coefficient gamma_dist=-0.5.

The Gaussian flow DGPs (generate_flow_data, generate_panel_flow_data and their separable variants) default to distribution="lognormal", returning strictly-positive flows y = exp(eta) where eta is the latent SAR-filtered linear predictor (also exposed in the result dict as "eta_vec" / "eta"). Pass distribution="normal" to recover the legacy Gaussian-on-y behaviour. The Gaussian-likelihood flow models in neighbayes.models.flow operate on the latent scale, so fit on np.log(y) to recover the SAR parameters. The Negative Binomial DGPs are unchanged.

generate_flow_data([n, G, rho_d, rho_o, ...])

Simulate flow data from a SAR flow model.

generate_flow_data_separable([n, G, rho_d, ...])

Simulate flow data from a separable SAR flow model.

generate_negbin_flow_data([n, k, k_d, k_o, ...])

Generate synthetic O-D flow counts from an NB2 SAR flow DGP.

generate_negbin_flow_data_separable([n, ...])

NB2 flow DGP with separability constraint rho_w = -rho_d * rho_o.

generate_sem_flow_data([n, G, lam_d, lam_o, ...])

Simulate flow data from a spatial-error (SEM) flow model.

generate_sem_flow_data_separable([n, G, ...])

Simulate SEM flow data with the separability constraint \(\lambda_w = -\lambda_d \lambda_o\).

generate_panel_flow_data([n, T, G, rho_d, ...])

Simulate panel flow data from a SAR flow model with unit effects.

generate_panel_flow_data_separable([n, T, ...])

Simulate panel flow data from a separable SAR flow model.

generate_panel_negbin_flow_data([n, T, G, ...])

Generate panel NB2 flow counts from a spatial autoregressive DGP.

generate_panel_negbin_flow_data_separable([...])

Panel NB2 flow DGP with separability constraint rho_w=-rho_d*rho_o.

generate_panel_sem_flow_data([n, T, G, ...])

Simulate panel SEM flow data with O-D-pair random effects.

generate_panel_sem_flow_data_separable([n, ...])

Panel SEM flow DGP with separability constraint \(\lambda_w = -\lambda_d \lambda_o\).

Graph Utilities

FlowDesignMatrix(X_dest, X_orig, X_intra, ...)

Combined design matrix for an O-D flow regression.

flow_design_matrix(X[, col_names, dist, ...])

Build a flow regression design matrix from regional attribute data.

flow_design_matrix_asymmetric(Xd, Xo[, ...])

Build a flow design matrix with different numbers of dest/origin variables.

flow_design_matrix_with_orig(Xd, Xo[, ...])

Build a flow design matrix with separate destination and origin data.

flow_weight_matrices(G)

Build all three N×N flow weight matrices from a single Graph.

destination_weights(G)

Build the N×N destination weight matrix \(W_d = I_n \otimes W\).

origin_weights(G)

Build the N×N origin weight matrix \(W_o = W \otimes I_n\).

network_weights(G)

Build the N×N network weight matrix \(W_w = W \otimes W\).