ConvergenceTest#
- class cultivars.bayes.chains.ConvergenceTest(*, names, mean, sd, mcse, ess_bulk, ess_tail, rhat, geweke, n_chains, n_draws, rhat_tol, min_ess, source)[source]#
Per-parameter convergence diagnostics of a Markov chain Monte Carlo run.
One row per scalar quantity: its posterior mean and spread, the Monte Carlo standard error of that mean, rank-normalized bulk and tail effective sample sizes, rank-normalized split-R-hat with folding, and the largest-magnitude Geweke score across chains. The verdict applies the Vehtari et al. (2021) thresholds the report carries, so two reports are comparable only when their thresholds are.
A parameter whose chain never moved has
nanin every column and is listed underdegeneraterather than counted against the verdict: the report cannot tell a parameter fixed by construction from a sampler that is stuck, and refuses to guess. Read the list.With a single chain, split-R-hat compares the two halves of that chain, which detects drift but not a chain stuck in one of several modes; the summary says so. The between-chain reading needs a second run with a different seed passed alongside the first. Two half-chains also make the statistic noisy when they are short: an independent sequence of 200 draws exceeds 1.01 about a fifth of the time and one of 500 draws about a fiftieth, so a flag close to the threshold on a short single chain is a reason to run longer, not a verdict.
- Variables:
names (
tuple[str,...]) – Label of every scalar quantity, in row order.mcse (
NDArray[double]) –(d,)Monte Carlo standard errors of the means.ess_bulk (
NDArray[double]) –(d,)bulk effective sample sizes.ess_tail (
NDArray[double]) –(d,)tail effective sample sizes.geweke (
NDArray[double]) –(d,)signed Geweke scores, the one of largest magnitude across chains;nanwhen the chains are too short for the default segments.n_chains (
int) – Independent chains the diagnostics pooled.n_draws (
int) – Kept draws per chain.rhat_tol (
float) – R-hat above which a parameter is flagged.min_ess (
float) – Effective draws per chain below which a parameter is flagged, so the floor applied ismin_ess * n_chains.source (
str) – What was assessed, for the summary title.
See also
ConvergenceTest– the public name of this class.convergence()– returns an instance.BVARResult.convergence()– returns an instance.FactorSVResult.convergence()– returns an instance.GibbsBVARResult.convergence()– returns an instance.
Attributes#
Label of every scalar quantity, in row order. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Independent chains the diagnostics pooled. |
|
Kept draws per chain. |
|
R-hat above which a parameter is flagged. |
|
Effective draws per chain below which a parameter is flagged, so the floor applied is |
|
What was assessed, for the summary title. |
|
Whether no assessed quantity is flagged. |
|
Quantities whose chain never moved, excluded from the verdict. |
|
Total effective draws below which a parameter is flagged. |
|
Quantities failing the R-hat or either effective-sample-size test. |