bayespecon.diagnostics.lmtests.bayesian_lm_sdm_joint_test¶
- bayespecon.diagnostics.lmtests.bayesian_lm_sdm_joint_test(model)[source]¶
Bayesian joint LM test for SDM (H₀: ρ = 0 AND γ = 0 | OLS).
Bayesian extension of the joint LM-SDM test ([Koley and Bera, 2024],
lm_spdurbin) using the Doğan, Taşpınar & Bera (2021) framework ([Doğan et al., 2021], Proposition 1).The null model is OLS. For each posterior draw of \((\beta, \sigma^2)\) the joint raw score is
\[\begin{split}\mathbf{g}^{(d)} = \begin{pmatrix} \mathbf{e}^{(d)\,\top} W \mathbf{y} \\ (WX)^\top \mathbf{e}^{(d)} \end{pmatrix}, \qquad \mathbf{e}^{(d)} = \mathbf{y} - X \beta^{(d)}.\end{split}\]Concentrating \(\beta\) out of the SDM information matrix ([Koley and Bera, 2024]) gives the \((1 + k_{wx}) \times (1 + k_{wx})\) variance matrix of the raw score:
\[\begin{split}V = \begin{pmatrix} \bar{\sigma}^4\, T_{WW} + \bar{\sigma}^2\, \| M_X W X \bar{\beta} \|^2 & \bar{\sigma}^2\, (W X \bar{\beta})^\top M_X (WX) \\ \bar{\sigma}^2\, (WX)^\top M_X (W X \bar{\beta}) & \bar{\sigma}^2\, (WX)^\top M_X (WX) \end{pmatrix},\end{split}\]where \(M_X = I - X(X^\top X)^{-1} X^\top\) is the OLS annihilator and \(T_{WW} = \mathrm{tr}(W^\top W + W^2)\). This matches the Schur-complemented information matrix in spreg’s
lm_spdurbin, evaluated at the posterior-mean \((\bar{\beta}, \bar{\sigma}^2)\) rather than the OLS estimate.The per-draw LM statistic is
\[\mathrm{LM}^{(d)} = \mathbf{g}^{(d)\,\top} V^{-1} \mathbf{g}^{(d)} \;\xrightarrow{d}\; \chi^2_{1 + k_{wx}} \quad \text{under } H_0.\]- Parameters:¶
- model : SpatialModel¶
Fitted OLS-like model with
inference_dataattribute providing posterior draws ofbetaandsigma.
- Returns:¶
Per-draw LM samples, summary statistics,
df = 1 + k_{wx}and metadata.- Return type:¶