bayespecon.diagnostics.lmtests.bayesian_lm_flow_intra_test

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

Bayesian LM (WX-style) test for the intra block in an OLSFlow null.

Tests \(H_0\colon \beta_{\text{intra}} = 0\) in the gravity model

\[y = \alpha + g \gamma + X_d \beta_d + X_o \beta_o + X_{\text{intra}} \beta_{\text{intra}} + \varepsilon,\]

using a fitted OLSFlow whose design already contains the intra block (the standard layout from bayespecon.graph.flow_design_matrix()). Per posterior draw the intra-block score is \(g_g = X_{\text{intra}}^\top e_g\) with \(e_g = y - X \beta_g\) (full-design residual) and the variance is \(V = X_{\text{intra}}^\top X_{\text{intra}} / \bar\sigma^{2}\), matching the SDM-style WX information block of Doğan et al. [2021]. The statistic is \(LM_g = g_g^\top V^{-1} g_g\), df \(= k_{\text{intra}}\).

Notes

The test treats the intra block as the “WX” addition relative to a null with the same dest/orig coefficients but no intra columns. The score is evaluated at the OLSFlow draws — this is asymptotically equivalent to refitting an “OLSFlow without intra” null when the intra block is orthogonal to X_dest/X_orig (typically the case for the diagonal-mask layout used by flow_design_matrix).