neighbayes.diagnostics.lmtests.bayesian_panel_lm_error_test¶
- neighbayes.diagnostics.lmtests.bayesian_panel_lm_error_test(model)[source]¶
Bayesian panel LM test for omitted spatial error (H₀: λ = 0).
Follows Anselin et al. [2008] and the Bayesian framework of Doğan et al. [2021]. (2021). Tests whether a spatial error term should be added to a panel regression.
The null model is a pooled/FE panel OLS. For each posterior draw, residuals are computed (demeaned for FE, alpha-adjusted for RE).
The score for each draw is:
\[S = \mathbf{e}^\top W_{NT} \mathbf{e}\]The variance is:
\[V = \sigma^4 \cdot T \cdot \mathrm{tr}(W'W + W^2)\]The LM statistic for each draw is:
\[\mathrm{LM} = \frac{S^2}{V}\]which is distributed as \(\chi^2_1\) under H₀.