bayespecon.diagnostics.bayesian_lmtests.bayesian_panel_robust_lm_lag_test

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

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

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

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{y}}{\sigma^2} - \frac{\mathbf{e}^\top W \mathbf{e}}{\sigma^2} \right)^2 }{J - T \cdot \mathrm{tr}(W'W + W^2)}\]

where \(J\) is the information matrix from the panel LM-lag test and \(\mathrm{tr}\) denotes \(\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