bayespecon.diagnostics.lmtests.bayesian_robust_lm_wx_sem_test

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

Bayesian robust LM-WX test in SEM context (H₀: γ = 0 | SEM).

Companion to bayesian_robust_lm_lag_sem_test() with target and nuisance swapped: tests whether the SEM fit should be extended to SDEM by adding the WX block, robust to a locally-omitted spatial lag.

Setup mirrors bayesian_robust_lm_lag_sem_test(): per-draw whitened residuals \(\mathbf{u}^{(d)} = (I - \lambda^{(d)} W) (\mathbf{y} - X\beta^{(d)})\), filtered designs at \(\bar\lambda\), raw scores

\[\mathbf{g}_\gamma^{(d)} = \tilde Z_\gamma^{\top} \mathbf{u}^{(d)}, \qquad g_\rho^{(d)} = \mathbf{u}^{(d)\,\top} \tilde z_\rho.\]

The Neyman-orthogonal adjustment and Schur complement (with target \(\gamma\), nuisance \(\rho\)) give

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

The per-draw statistic is

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

independent of local misspecification in \(\rho\).

Parameters:
model : SEM

Fitted SEM model with inference_data containing posterior draws for beta, lam (or lambda) and sigma.

Returns:

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

Return type:

BayesianLMTestResult