bayespecon.diagnostics.lmtests.bayesian_lm_error_sdm_test

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

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

Tests whether an SDM model should be extended to a MANSAR (Manski) model that adds a spatially correlated error term. Residuals are computed using the SDM mean structure including the spatial lag of y:

\[\mathbf{e} = \mathbf{y} - \rho W\mathbf{y} - X\beta - WX\theta\]

so that the LM-Error score and variance are evaluated at posterior draws from the correct fitted model. The score and variance follow the standard LM-Error formulation (Anselin et al. [1996]), kept on the raw-score scale consistent with bayesian_lm_error_test():

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

Returns LM = S^2 / V per draw, distributed as \(\chi^2_1\) under H₀.