Result Types¶
Named tuples returned by testing and diagnostic functions.
TestResult
¶
Bases: NamedTuple
Result of a two-sample permutation hypothesis test.
Returned by :func:~divergence.two_sample.permutation_test and related
testing functions. Fields can be accessed by name or by index.
Attributes:
| Name | Type | Description |
|---|---|---|
statistic |
float
|
The observed test statistic computed on the original (unpermuted) samples. |
p_value |
float
|
The permutation p-value: the fraction of permuted statistics that are at least as extreme as the observed statistic. |
null_distribution |
ndarray
|
Array of test-statistic values computed under each permutation of the sample labels, representing the null distribution. |
ChainKSDResult
¶
Bases: NamedTuple
Result of per-chain kernel Stein discrepancy analysis.
Returned by :func:~divergence.bayesian.chain_ksd. Each field
corresponds to KSD values computed on different subsets of the MCMC
output. Small values indicate that the chain's empirical distribution
is close to the target.
Attributes:
| Name | Type | Description |
|---|---|---|
ksd_per_chain |
ndarray
|
KSD value for each chain, shape |
ksd_split_first |
ndarray or None
|
KSD for the first half of each chain, shape |
ksd_split_second |
ndarray or None
|
KSD for the second half of each chain, shape |
ksd_pooled |
float
|
KSD computed from all chains pooled together. |
ChainTestResult
¶
Bases: NamedTuple
Result of pairwise two-sample tests between MCMC chains.
Returned by :func:~divergence.bayesian.chain_two_sample_test.
Provides calibrated p-values for the null hypothesis that each pair
of chains samples from the same distribution.
Attributes:
| Name | Type | Description |
|---|---|---|
p_value_matrix |
ndarray
|
Pairwise p-values, shape |
statistic_matrix |
ndarray
|
Pairwise test statistics, shape |
min_p_value |
float
|
Minimum off-diagonal p-value across all chain pairs. The most evidence of distributional discrepancy. |
any_significant |
bool
|
Whether any chain pair has a p-value below 0.05. |
MixingDiagnostic
¶
Bases: NamedTuple
Result of transfer-entropy-based mixing diagnostics.
Returned by :func:~divergence.bayesian.mixing_diagnostic. Uses
transfer entropy to detect non-stationarity within chains and
spurious dependence between chains.
Attributes:
| Name | Type | Description |
|---|---|---|
stationarity_te |
ndarray
|
Transfer entropy from the first half to the second half of each
chain, shape |
cross_chain_te |
ndarray
|
Transfer entropy between consecutive chain pairs, shape
|