bayespecon.diagnostics.lmtests.bayesian_robust_lm_error_sar_test

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

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

Tests whether a SAR fit should be extended to SARAR by adding a spatial-error process, robust to the locally-estimated lag parameter \(\rho\). Implements the Doǧan–Taşpınar–Bera (2021) Bayesian Neyman-orthogonal score adjustment ([Doğan et al., 2021], Proposition 3) with the SARAR information blocks at the SAR posterior mean ([Anselin, 1988], [Anselin et al., 1996]).

For each posterior draw of \((\beta, \rho, \sigma^2)\) from the SAR fit the residual is \(\mathbf{e}^{(d)} = \mathbf{y} - \rho^{(d)} W\mathbf{y} - X\beta^{(d)}\), and the raw scores are

\[g_\lambda^{(d)} = \mathbf{e}^{(d)\,\top} W \mathbf{e}^{(d)}, \qquad g_\rho^{(d)} = \mathbf{e}^{(d)\,\top} W \mathbf{y}.\]

With \(\bar A = I - \bar\rho W\), \(G = \bar A^{-1} W\) and \(T_{B,C} = \mathrm{tr}(B^\top C + BC)\), the variance blocks at \(\theta^\star\) are

\[\begin{split}V_{\lambda\lambda} &= \bar\sigma^4 \, T_{WW},\\ V_{\lambda\rho} &= \bar\sigma^4 \, T_{W,G},\\ V_{\rho\rho} &= \bar\sigma^4 \, T_{G,G} + \bar\sigma^2 \, \| M_X (G\,X\bar\beta) \|^2.\end{split}\]

The Neyman-orthogonal adjusted score is

\[g_\lambda^{*\,(d)} = g_\lambda^{(d)} - \frac{V_{\lambda\rho}}{V_{\rho\rho}}\, g_\rho^{(d)},\]

with adjusted variance \(V_{\lambda\,|\,\rho} = V_{\lambda\lambda} - V_{\lambda\rho}^2 / V_{\rho\rho}\) and per-draw statistic

\[\mathrm{LM}_R^{(d)} = \frac{(g_\lambda^{*\,(d)})^2} {V_{\lambda\,|\,\rho}} \;\xrightarrow{d}\; \chi^2_1 \quad \text{under } H_0,\]

independent of local misspecification in \(\rho\).

Parameters:
model : SAR

Fitted SAR model exposing inference_data with posterior draws of beta, rho, sigma and the cached _y, _X, _Wy, _W_sparse, _W_dense, _T_ww attributes.

Returns:

Per-draw LM samples, summary statistics and df = 1.

Return type:

BayesianLMTestResult