bayespecon.diagnostics.lmtests.bayesian_robust_lm_lag_sdm_test¶
- bayespecon.diagnostics.lmtests.bayesian_robust_lm_lag_sdm_test(model)[source]¶
Bayesian robust LM-Lag test in SDM context (H₀: ρ = 0, robust to γ).
Tests the null hypothesis that the spatial lag 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-Lag-SDM test in Koley and Bera [2024].
The alternative model is SDM (the SLX relaxation that adds \(\rho\)); the null model used to draw posteriors is SLX, in which \(\gamma\) is a free parameter and has already been absorbed into the residuals. For each posterior draw of \((\beta, \gamma, \sigma^2)\) from the SLX fit, residuals are
\[\mathbf{e} = \mathbf{y} - X\beta - WX\gamma,\]and the raw scores are
\[g_\rho = \mathbf{e}^\top W \mathbf{y}, \qquad g_\lambda = \mathbf{e}^\top W \mathbf{e}.\]The companion score for \(\gamma\), \(\mathbf{g}_\gamma = (WX)^\top \mathbf{e}\), is identically zero by the OLS normal equations of the SLX fit, so the γ-direction of the Doğan-Taşpınar-Bera Neyman-orthogonal adjustment ([Doğan et al., 2021], Proposition 3) collapses to a no-op. However the SLX null leaves \(\lambda\) unconcentrated: when the true DGP is SDEM, \(g_\rho\) is biased upward by \(\sigma^2 \, \mathrm{tr}\bigl(M_Z W (I-\lambda W)^{-1} (I-\lambda W^\top)^{-1}\bigr)\), which destroys the χ² calibration at moderate-to-large \(n\). We therefore Schur-correct on \(\lambda\) as a second nuisance, using the raw-score variance blocks at the SLX null supplied by
_info_matrix_blocks_slx_robust():\[\begin{split}g_\rho^* &= g_\rho - \frac{J_{\rho\lambda}}{J_{\lambda\lambda}}\, g_\lambda \\ V_{\rho \cdot \lambda} &= J_{\rho\rho} - \frac{J_{\rho\lambda}^2}{J_{\lambda\lambda}}\end{split}\]with
\[\begin{split}J_{\rho\rho} &= \bar{\sigma}^4 T_{WW} + \bar{\sigma}^2 \, \| M_Z W Z \bar{\beta}_{slx} \|^2 \\ J_{\lambda\lambda} &= \bar{\sigma}^4 T_{WW} \\ J_{\rho\lambda} &= \bar{\sigma}^4 \, \bigl[\,\mathrm{tr}(M_Z W M_Z W) + \mathrm{tr}(M_Z W M_Z W^\top)\,\bigr]\end{split}\]where \(Z = [X, WX]\) is the SLX design and \(M_Z = I - Z(Z^\top Z)^{-1} Z^\top\) is the SLX OLS annihilator. The per-draw robust LM statistic is
\[\mathrm{LM}_R^{(d)} = \frac{\bigl(g_\rho^{*\,(d)}\bigr)^2} {V_{\rho \cdot \lambda}} \;\xrightarrow{d}\; \chi^2_1 \quad \text{under } H_0,\]independent of local misspecification in either \(\gamma\) or \(\lambda\).