bayespecon.diagnostics.lmtests.bayesian_lm_slx_error_joint_test

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

Bayesian joint LM test for SDEM (H₀: λ = 0 AND γ = 0 | OLS).

Bayesian extension of the joint LM-SLX-Error test ([Koley and Bera, 2024], lm_slxerr) 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{e}^{(d)} \\ (WX)^\top \mathbf{e}^{(d)} \end{pmatrix}, \qquad \mathbf{e}^{(d)} = \mathbf{y} - X \beta^{(d)}.\end{split}\]

Under \(H_0\) with spherical errors, \(\mathrm{Cov}(\mathbf{e}^\top W \mathbf{e},\ (WX)^\top \mathbf{e}) = 0\) (third moments of normal errors vanish), so the information matrix is block-diagonal — matching spreg’s lm_slxerr which simply adds LM_Error + LM_WX ([Koley and Bera, 2024]). The variance of the raw score is

\[\begin{split}V = \begin{pmatrix} \bar{\sigma}^4\, T_{WW} & 0 \\ 0 & \bar{\sigma}^2\, (WX)^\top M_X (WX) \end{pmatrix},\end{split}\]

where \(M_X = I - X(X^\top X)^{-1} X^\top\) and \(T_{WW} = \mathrm{tr}(W^\top W + W^2)\). 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_data attribute providing posterior draws of beta and sigma.

Returns:

Per-draw LM samples, summary statistics, df = 1 + k_{wx} and metadata.

Return type:

BayesianLMTestResult