bayespecon.diagnostics.lmtests.bayesian_panel_robust_lm_wx_test

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

Bayesian panel robust LM-WX (H₀: γ = 0 | SAR panel, robust to ρ).

Bayesian extension of the classical robust LM-WX test ([Koley and Bera, 2024]) using the Dogǎn, Tas̛pınar & Bera (2021) framework ([Doğan et al., 2021], Proposition 3) with panel-data adjustments ([Anselin et al., 2008], [Elhorst, 2014]).

The alternative model is SAR panel (includes \(\rho\) but not \(\gamma\)). For each posterior draw of \((\beta, \rho, \sigma^2)\) the SAR residual is \(\mathbf{e}^{(d)} = \mathbf{y} - \rho^{(d)} W_{NT} \mathbf{y} - X \beta^{(d)}\). The raw scores are

\[g_\rho^{(d)} = \mathbf{e}^{(d)\,\top} W_{NT} \mathbf{y}, \qquad \mathbf{g}_\gamma^{(d)} = (WX)^\top \mathbf{e}^{(d)}.\]

The Neyman-orthogonal adjusted score uses the canonical Schur complement of the raw-score variance matrix:

\[\begin{split}\mathbf{g}_\gamma^{*\,(d)} &= \mathbf{g}_\gamma^{(d)} - V_{\gamma\rho} V_{\rho\rho}^{-1} g_\rho^{(d)}, \\ V_{\gamma\gamma\,|\,\rho} &= V_{\gamma\gamma} - V_{\gamma\rho} V_{\rho\rho}^{-1} V_{\rho\gamma}.\end{split}\]

The per-draw LM statistic is

\[\mathrm{LM}^{(d)} = \mathbf{g}_\gamma^{*\,(d)\,\top} V_{\gamma\gamma\,|\,\rho}^{-1} \mathbf{g}_\gamma^{*\,(d)} \;\xrightarrow{d}\; \chi^2_{k_{wx}} \quad \text{under } H_0.\]
Parameters:
model : SARPanelFE or SARPanelRE

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

Returns:

Per-draw LM samples, summary statistics and df = k_{wx}.

Return type:

BayesianLMTestResult