bayespecon.diagnostics.bayesian_lmtests.bayesian_panel_lm_wx_test

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

Bayesian panel LM test for WX coefficients (H₀: γ = 0).

Tests whether spatially lagged covariates (WX) should be added to a SAR panel model, i.e., whether SAR should be extended to SDM. Follows the multi-parameter Bayesian LM test framework of Doğan et al. [2021] and Koley and Bera [2024].

The null model is a SAR panel (includes ρ but not γ). For each posterior draw from the SAR model, residuals are:

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

The score vector for the WX coefficients is:

\[\mathbf{g}_\gamma = (WX)^\top \mathbf{e}\]

The concentration matrix is:

\[J_{\gamma\gamma} = \frac{1}{\bar{\sigma}^2} (WX)^\top (WX)\]

The LM statistic for each draw is:

\[\mathrm{LM} = \mathbf{g}_\gamma^\top J_{\gamma\gamma}^{-1} \mathbf{g}_\gamma\]

distributed as \(\chi^2_{k_{wx}}\) under H₀.

Parameters:
model : SARPanelFE or SARPanelRE

Fitted SAR panel model with inference_data containing posterior draws for beta, rho, and sigma.

Returns:

Dataclass containing LM samples, summary statistics, and metadata. The df field is set to \(k_{wx}\).

Return type:

BayesianLMTestResult