bayespecon.diagnostics.lmtests.bayesian_lm_error_test¶
- bayespecon.diagnostics.lmtests.bayesian_lm_error_test(model)[source]¶
Bayesian LM test for omitted spatial error (SEM) model.
Bayesian extension of the classical LM-Error test ([Anselin et al., 1996], eq. 9) using the Doğan, Taşpınar & Bera (2021) quadratic-net-loss framework ([Doğan et al., 2021], Proposition 1). The score and concentration matrix come from the OLS log-likelihood; the spatial error parameter \(\lambda\) is information-orthogonal to \(\beta\) under \(H_0\) so no Schur projection is needed.
For each posterior draw the raw score is
\[S^{(d)} = \mathbf{e}^{(d)\,\top} W \mathbf{e}^{(d)}, \qquad \mathbf{e}^{(d)} = \mathbf{y} - X \beta^{(d)}.\]Under \(H_0\) with spherical errors, the variance of the raw score (negative-Hessian block at \(\theta^\star\)) is
\[V = \bar{\sigma}^4 \, T_{WW}, \qquad T_{WW} = \mathrm{tr}(W^\top W + W^2),\]where \(\bar{\sigma}^2\) is the posterior mean of \(\sigma^2\). The per-draw LM statistic is
\[\mathrm{LM}^{(d)} = \frac{\bigl(S^{(d)}\bigr)^2}{V} \;\xrightarrow{d}\; \chi^2_1 \quad \text{under } H_0,\]and the Bayesian p-value is computed at the posterior-mean LM ([Doğan et al., 2021], eq. 3.7).
- Parameters:¶
- model : SpatialModel¶
Fitted OLS-like model with
inference_dataattribute providing posterior draws ofbetaandsigma, plus the cached_y,_X,_W_sparse,_T_wwattributes.
- Returns:¶
Per-draw LM samples, summary statistics,
df=1and metadata.- Return type:¶