geweke_test
validation.geweke_test(
kernel='simple',
T0=15,
N=8,
K=2,
p=1,
spatial_W=None,
spatial_w=None,
alpha=None,
X=None,
y0_pre=None,
m_iid=20000,
m_mcmc=20000,
burn=5000,
a0=1.0,
b0=1.0,
step_rho=0.05,
rho_support=None,
beta_prior='horseshoe',
g_fn=None,
batch_size=None,
alpha_level=0.05,
bonferroni=True,
seed=None,
verbose=False,
)Run the Geweke joint distribution test of the Step-2 sampler.
Defaults mirror the replication package’s Geweke driver: a T0 = 15 x N = 8 panel on a chain graph with w = e_1, K = 2 iid standard-normal covariates, p = 1 latent factor, and standardized synthetic weights drawn N(0, 0.4^2).
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| kernel | ('simple', 'production') | "simple" tests the appendix’s simplified model (comparable to the R package’s frozen table); "production" tests the sampler users actually run. A custom object implementing draw_prior / simulate_data / transition / state_summary / extra_stats (see :mod:scspill.validation.kernels) is accepted. |
"simple" |
| T0 | int | Panel and model dimensions (ignored for a custom kernel object). | 15 |
| N | int | Panel and model dimensions (ignored for a custom kernel object). | 15 |
| K | int | Panel and model dimensions (ignored for a custom kernel object). | 15 |
| p | int | Panel and model dimensions (ignored for a custom kernel object). | 15 |
| spatial_W | arrays | Overrides of the toy design; drawn/derived from seed when omitted. |
None |
| spatial_w | arrays | Overrides of the toy design; drawn/derived from seed when omitted. |
None |
| alpha | arrays | Overrides of the toy design; drawn/derived from seed when omitted. |
None |
| X | arrays | Overrides of the toy design; drawn/derived from seed when omitted. |
None |
| y0_pre | arrays | Overrides of the toy design; drawn/derived from seed when omitted. |
None |
| m_iid | int | Draw counts of the two simulators and the transition burn-in. | 20000 |
| m_mcmc | int | Draw counts of the two simulators and the transition burn-in. | 20000 |
| burn | int | Draw counts of the two simulators and the transition burn-in. | 20000 |
| a0 | sampler settings | Passed to the kernel (beta_prior is production-only). |
1.0 |
| b0 | sampler settings | Passed to the kernel (beta_prior is production-only). |
1.0 |
| step_rho | sampler settings | Passed to the kernel (beta_prior is production-only). |
1.0 |
| rho_support | sampler settings | Passed to the kernel (beta_prior is production-only). |
1.0 |
| beta_prior | sampler settings | Passed to the kernel (beta_prior is production-only). |
1.0 |
| g_fn | callable | g_fn(summary, Yc, y0_pre, Wn, wn) -> dict replacing :func:default_g_fn. |
None |
| batch_size | int | Batch length for the MCMC standard error (default floor(sqrt(m))). |
None |
| alpha_level | float | Familywise test level. | 0.05 |
| bonferroni | bool | Bonferroni-adjust the critical value across statistics. | True |
| seed | int | Seed for all randomness (design draws included). | None |
| verbose | bool | Print stage progress. | False |
Returns
| Name | Type | Description |
|---|---|---|
| GewekeReport | The per-statistic z table and the pass decision. |
Notes
The successive-conditional simulator mixes slowly along two well-known directions, and an under-resolved run flags them as spurious failures:
- the
rhochain moves only as far per sweep as its data-conditional posterior allows, so informative designs (largeT0 * N) make it diffuse slowly – keep the test panel small (e.g.T0=4, N=4); - with
K > 0andp > 0simultaneously, theX betaandEta Gammamean components trade off along a ridge whose relaxation dominates the global data statistics – test the blocks in isolation first, and give joint configurations long chains with a largebatch_size; - the production kernel’s half-Cauchy scale hierarchies are funnel-shaped and effectively untestable at feasible chain lengths (the reason the replication package only ever tested the simplified kernel, at two million draws).
A genuine incoherence shows up as a stable, sign-consistent z across seeds and scales; mixing artifacts flip sign and shrink as the chain grows.