bayespecon.diagnostics.lmtests.bayesian_robust_lm_lag_test

bayespecon.diagnostics.lmtests.bayesian_robust_lm_lag_test(model)[source]

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

Cross-sectional analogue of bayesian_panel_robust_lm_lag_test(). Tests whether the spatial-lag coefficient is zero, robust to the local presence of spatial-error autocorrelation. The null model is OLS.

For each posterior draw,

\[\mathrm{LM}_R = \frac{\bigl(g_\rho/\sigma^2 - g_\lambda/\sigma^2\bigr)^2} {J_{\rho\rho}/\sigma^2 - T_{WW}}\]

where \(g_\rho = \mathbf{e}^\top W\mathbf{y}\), \(g_\lambda = \mathbf{e}^\top W\mathbf{e}\), \(J_{\rho\rho} = (WX\hat\beta)^\top M (WX\hat\beta) + T_{WW}\bar\sigma^2\), and \(T_{WW} = \mathrm{tr}(W^\top W + W^2)\). Distributed as \(\chi^2_1\) under H₀. The robust adjustment follows the Anselin–Bera–Florax–Yoon construction ([Anselin et al., 1996]) derived from the locally-misspecified Lagrange-multiplier framework of Bera and Yoon [1993]. The Bayesian LM statistic is computed per posterior draw following Doğan et al. [2021].

Parameters:
model : SpatialModel

Fitted OLS-style model with inference_data containing posterior draws for beta and sigma.

Returns:

Dataclass containing LM samples, summary statistics, and metadata.

Return type:

BayesianLMTestResult