bayespecon.diagnostics.bayesian_lmtests.bayesian_lm_wx_test¶
- bayespecon.diagnostics.bayesian_lmtests.bayesian_lm_wx_test(model)[source]¶
Bayesian LM test for WX coefficients (H₀: γ = 0).
Tests whether spatially lagged covariates (WX) should be added to a SAR model, i.e., whether the SAR model should be extended to an SDM specification. Follows the multi-parameter Bayesian LM test framework of Doğan et al. [2021] and the classical LM-WX test of Koley and Bera [2024].
The null model is SAR (includes ρ but not γ). For each posterior draw from the SAR model, residuals are:
\[\mathbf{e} = \mathbf{y} - \rho W \mathbf{y} - X \beta\]The score vector for the WX coefficients is:
\[\mathbf{g}_\gamma = (WX)^\top \mathbf{e}\]a \(k_{wx} \times 1\) vector for each draw. The concentration matrix is the information matrix evaluated at the posterior mean:
\[J_{\gamma\gamma} = \frac{1}{\bar{\sigma}^2} (WX)^\top (WX)\]where \(\bar{\sigma}^2\) is the posterior mean of \(\sigma^2\). The LM statistic for each draw is:
\[\mathrm{LM} = \mathbf{g}_\gamma^\top J_{\gamma\gamma}^{-1} \mathbf{g}_\gamma\]which is distributed as \(\chi^2_{k_{wx}}\) under H₀.