bayespecon.diagnostics.bayesian_lmtests.bayesian_panel_robust_lm_error_test

bayespecon.diagnostics.bayesian_lmtests.bayesian_panel_robust_lm_error_test(model)[source]

Bayesian panel robust LM-Error test (H₀: λ = 0, robust to ρ).

Follows Elhorst [2014]. Tests the null hypothesis that the spatial error coefficient is zero, robust to the local presence of a spatial lag.

The null model is a pooled/FE panel OLS. The robust LM statistic is:

\[\mathrm{LM}_R = \frac{ \left( \frac{\mathbf{e}^\top W \mathbf{e}}{\sigma^2} - \frac{T \cdot \mathrm{tr}}{J} \cdot \frac{\mathbf{e}^\top W \mathbf{y}}{\sigma^2} \right)^2 }{ T \cdot \mathrm{tr} \cdot \left(1 - \frac{T \cdot \mathrm{tr}}{J}\right) }\]

where \(J\) is the information matrix from the panel LM-lag test and \(\mathrm{tr} = \mathrm{tr}(W'W + W^2)\).

This is distributed as \(\chi^2_1\) under H₀.

Parameters:
model : SpatialPanelModel

Fitted panel model (e.g. OLSPanelFE) with inference_data attribute containing posterior draws for beta and sigma.

Returns:

Dataclass containing LM samples, summary statistics, and metadata.

Return type:

BayesianLMTestResult