bayespecon.diagnostics.bayesian_lmtests.bayesian_robust_lm_error_sdem_test

bayespecon.diagnostics.bayesian_lmtests.bayesian_robust_lm_error_sdem_test(model)[source]

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

Tests the null hypothesis that the spatial error coefficient is zero, robust to the local presence of WX effects (γ). Uses the Neyman orthogonal score adjustment from Doğan et al. [2021], Proposition 3, which is the Bayesian analogue of the robust LM-Error test in the SDEM context.

The alternative model is SLX (includes γ but not λ). For each posterior draw from the SLX model, residuals are:

\[\mathbf{e} = \mathbf{y} - X\beta_1 - WX\beta_2\]

The unadjusted scores are:

\[\begin{split}g_\lambda &= \mathbf{e}^\top W \mathbf{e} \\ \boldsymbol{g}_\gamma &= (WX)^\top \mathbf{e}\end{split}\]

The Neyman-adjusted score for λ is:

\[g_\lambda^* = g_\lambda - J_{\lambda\gamma \cdot \sigma} J_{\gamma\gamma \cdot \sigma}^{-1} \boldsymbol{g}_\gamma\]

The adjusted variance is:

\[V^* = J_{\lambda\lambda \cdot \sigma} - J_{\lambda\gamma \cdot \sigma} J_{\gamma\gamma \cdot \sigma}^{-1} J_{\gamma\lambda \cdot \sigma}\]

The robust LM statistic for each draw is:

\[\mathrm{LM}_R = \frac{(g_\lambda^*)^2}{V^*}\]

which is distributed as \(\chi^2_1\) under H₀, irrespective of local misspecification in γ.

Parameters:
model : SLX

Fitted SLX model instance with inference_data attribute containing posterior draws for beta and sigma.

Returns:

Dataclass containing LM samples, summary statistics, and metadata. The df field is set to 1.

Return type:

BayesianLMTestResult