bayespecon.diagnostics.lmtests.bayesian_panel_robust_lm_lag_sdm_test¶
- bayespecon.diagnostics.lmtests.bayesian_panel_robust_lm_lag_sdm_test(model)[source]¶
Bayesian panel robust LM-Lag in SDM context (H₀: ρ = 0 | SLX panel).
Tests \(H_0: \rho = 0\) using the SLX panel as the restricted null model. The SLX OLS normal equations zero the γ-direction score \((WX)^\top \mathbf{e}_{slx} = \mathbf{0}\) exactly, but leave the other spatial parameter \(\lambda\) as a non-trivial nuisance. Without correcting for it, residuals from the SLX null carry an unconcentrated component of any true λ and bias \(g_\rho = \mathbf{e}^\top W_{NT} \mathbf{y}\) upward — see the SDEM-DGP failure documented in
reference/lm_diagnostics_paper.md§5.9. Following [Doğan et al., 2021] (Proposition 3) we apply the Schur-complement Neyman correction with respect to λ:\[\begin{split}g_\rho^{*\,(d)} &= g_\rho^{(d)} - (J_{\rho\lambda}/J_{\lambda\lambda})\, g_\lambda^{(d)}, \\ V_{\rho|\lambda} &= J_{\rho\rho} - J_{\rho\lambda}^2 / J_{\lambda\lambda}, \\ \mathrm{LM}^{(d)} &= (g_\rho^{*\,(d)})^2 / V_{\rho|\lambda} \;\xrightarrow{d}\; \chi^2_1.\end{split}\]The information blocks are computed at the posterior means using Isserlis’ identity for \(\mathbf{e} \sim N(0, \sigma^2 M_Z)\) (with \(Z = [X,\;WX]\)):
\[\begin{split}J_{\rho\rho} &= \bar{\sigma}^4\, T \cdot T_{WW} + \bar{\sigma}^2 \|M_Z W_{NT} Z\bar{\beta}_{slx}\|^2 \\ J_{\lambda\lambda} &= \bar{\sigma}^4\, T \cdot T_{WW} \\ J_{\rho\lambda} &= \bar{\sigma}^4 \bigl[ \mathrm{tr}(M_Z W_{NT} M_Z W_{NT}) + \mathrm{tr}(M_Z W_{NT} M_Z W_{NT}^\top)\bigr]\end{split}\]where \(T_{WW} = \mathrm{tr}(W^\top W + W^2)\) and \(W_{NT} = I_T \otimes W\). Trace blocks are computed exactly via \(Z^\top W_{NT} Z\), \(Z^\top W_{NT}^2 Z\), etc., so that we never form the dense \((NT, NT)\) annihilator.
Note: this null model differs from the spreg-style algebraic subtraction (joint SDM minus LM-WX), which uses an OLS null and enforces orthogonality through information-matrix algebra. The two statistics target the same hypothesis but are not numerically equal.
- Parameters:¶
- model : SLXPanelFE or SLX-like panel model¶
Fitted SLX panel model with
inference_datacontaining posterior draws forbetaandsigma(betacovers the full SLX design[X, WX]).
- Returns:¶
Per-draw LM samples, summary statistics and
df = 1.- Return type:¶