bayespecon.models.flow_panel.OLSFlowPanel¶
- class bayespecon.models.flow_panel.OLSFlowPanel(y, G, X, T, **kwargs)[source]¶
Non-spatial Bayesian OD-flow gravity model for balanced panel data.
Panel analogue of
OLSFlow: implements the conventional log-linear gravity specification of (eq. 83.2) with no spatial lag terms,\[y_{t} = X_{t}\,\beta + \varepsilon_{t}, \quad \varepsilon_{t} \sim \mathcal{N}(0, \sigma^{2} I_{N}),\]on a balanced panel of \(T\) periods, applying the same fixed-effects within transform (model argument) as the spatial panel flow models. Provided as the canonical null model for Bayesian LM diagnostics on panel flow data.
- Parameters:¶
- y¶
See
FlowPanelModel. G is required for API symmetry but the spatial weights are not used in estimation.- G¶
See
FlowPanelModel. G is required for API symmetry but the spatial weights are not used in estimation.- X¶
See
FlowPanelModel. G is required for API symmetry but the spatial weights are not used in estimation.- T¶
See
FlowPanelModel. G is required for API symmetry but the spatial weights are not used in estimation.- col_names
See
FlowPanelModel. G is required for API symmetry but the spatial weights are not used in estimation.- k
See
FlowPanelModel. G is required for API symmetry but the spatial weights are not used in estimation.- model
See
FlowPanelModel. G is required for API symmetry but the spatial weights are not used in estimation.- priors
See
FlowPanelModel. G is required for API symmetry but the spatial weights are not used in estimation.- robust
See
FlowPanelModel. G is required for API symmetry but the spatial weights are not used in estimation.- symmetric_xo_xd
See
FlowPanelModel. G is required for API symmetry but the spatial weights are not used in estimation.
Notes
The
priorsdict supportsbeta_mu,beta_sigma,sigma_sigma; spatial keys (rho_*) are ignored. All log-determinant precomputation is skipped (A = I_Nwith \(|A| = 1\)).Methods
__init__(y, G, X, T, **kwargs)fit([draws, tune, chains, target_accept, ...])Draw samples from the posterior.
fit_approx([draws, n, method, random_seed, ...])Fit a variational approximation and return posterior draws.
posterior_predictive([n_draws, random_seed])Draw posterior-predictive flows for the OLS panel gravity model.
spatial_effects([draws, ...])Summarise posterior origin/destination/intra/network/total effects.
summary([var_names])Return posterior summary table via ArviZ.
Attributes
Return the most recent PyMC variational approximation, if any.
Return posterior draws from the most recent fit.
Return the most recently built PyMC model.
-
fit(draws=
2000, tune=1000, chains=4, target_accept=0.9, random_seed=None, store_lambda=False, idata_kwargs=None, **sample_kwargs)[source]¶ Draw samples from the posterior.
-
fit_approx(draws=
2000, n=10000, method='advi', random_seed=None, store_lambda=False, compute_log_likelihood=True, **fit_kwargs)[source]¶ Fit a variational approximation and return posterior draws.
- property inference_data : arviz.data.inference_data.InferenceData | None[source]¶
Return posterior draws from the most recent fit.
-
posterior_predictive(n_draws=
None, random_seed=None)[source]¶ Draw posterior-predictive flows for the OLS panel gravity model.
Overrides the base implementation, which expects
rho_d,rho_o,rho_wposterior arrays that this model does not sample.
- property pymc_model : pymc.model.core.Model | None[source]¶
Return the most recently built PyMC model.
-
spatial_effects(draws=
None, return_posterior_samples=False, ci=0.95, mode='auto')[source]¶ Summarise posterior origin/destination/intra/network/total effects.
See
bayespecon.models.flow.FlowModel.spatial_effects()for themodesemantics (auto / combined / separate destination-origin sides per Thomas-Agnan & LeSage 2014, §83.5.2).