bayespecon.diagnostics.lmtests.bayesian_lm_error_from_sar_test

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

Bayesian LM-Error test from a SAR posterior (H₀: λ = 0 | SAR).

SAR-aware companion of bayesian_lm_error_test(). Residuals are formed using the SAR mean structure \(\mathbf{e}^{(d)} = \mathbf{y} - \rho^{(d)} W\mathbf{y} - X\beta^{(d)}\) so that the LM-Error score is evaluated at the correct null model (SAR), not at OLS. The score and variance are otherwise identical to bayesian_lm_error_test():

\[S^{(d)} = \mathbf{e}^{(d)\,\top} W \mathbf{e}^{(d)}, \qquad V = \bar\sigma^4\, T_{WW},\]

so the per-draw statistic is \(\mathrm{LM}^{(d)} = (S^{(d)})^2/V\) and is referenced against \(\chi^2_1\).

This is a precursor diagnostic for the SAR-context Schur-robust LM-Error of bayesian_robust_lm_error_sar_test(); the decision tree fires the robust adjustment only when this naive test rejects.