Statistics & probability

MCMC convergence diagnostic calculator with rank normalized Rhat and effective sample size

Rank-normalized MCMC diagnostics compare within-chain and between-chain behavior and quantify serial efficiency.

Your numbers

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

Rank-normalized MCMC diagnostics compare within-chain and between-chain behavior and quantify serial efficiency. Split and folded Rhat, bulk ESS and tail ESS belong together because different failures can affect location, scale or tail exploration. These are diagnostics of retained draws, not proof that a sampler reached the intended distribution.

THE FORMULARhat=sqrt(var_plus/W) after split rank normalization; folded Rhat applies the same calculation to absolute deviations from the pooled median; ESS uses estimated integrated autocorrelation.

A worked example

The four forty-draw example chains give maximum rank-normalized/folded splitRhatapproximately1.0095733513. This number is a reproducible diagnostic for those entered draws, not a certificate that their generating algorithm converged.

Good to know

2–8 equal-length scalar chains,20–2000 retained draws per chain, total≤12000; no automatic warmup removal. Average ranks for ties, split chains, normal-score transformation, folded Rhat, and Geyer-style autocorrelation truncation for ESS. Reject degenerate diagnostics explicitly; passing diagnostics is not proof of stationarity, convergence or unbiased sampling.

Diagnose several chains together

A single chain can remain trapped while showing a quiet-looking trace. Multiple chains allow comparison of within-chain variability with variation between their means and distributions. The comparison is meaningful only when every chain targets the same parameter under the same intended stationary distribution. Combining draws from different models or differently transformed quantities does not create a convergence diagnostic.

Only retained scalar draws are accepted here. Warmup, adaptation and deliberately discarded iterations must already have been handled in the external sampling workflow. The page cannot determine a correct burn-in length from a short numerical matrix. Draw order within each chain must be preserved because the serial dependence estimate changes when observations are shuffled.

MCMC convergence diagnostic with rank normalized Rhat and effective sample sizeChain1Chain2Chain3Chain4Split + ranks + foldingRhat≈1.009573Inspect ESS and tailsRetained draws only; diagnostics do not certify convergence
Scroll across to see the full diagram.
The four forty-draw example chains give maximum rank-normalized/folded splitRhatapproximately1.0095733513. This number is a reproducible diagnostic for those entered draws, not a certificate that their generating algorithm converged.

Compare this with the Kish effective sample size from weights calculator. Diagnose several correlated simulation chains using split rank-normalized/folded Rhat and bulk/tail ESS. Weight-only Kish ESS ignores serial and between-chain behavior and cannot supply these diagnostics. Rhat, rank plots and both ESS measures stay on one page.

Split chains before comparing distributions

Splitting each chain into its first and second halves makes changes within a run visible as differences between shorter chains. An odd final observation may be omitted under the documented split convention. The resulting split chains need enough observations to estimate both within-chain variability and serial correlation; a short stable-looking run still contains limited diagnostic information.

Rank normalization pools the retained split draws and converts their ranks to normal scores. Average ranks handle ties consistently. This limits the direct influence of heavy-tailed magnitudes and puts chains on a comparable scale. It does not make a poorly explored posterior correct or restore information from regions none of the chains visited.

Combine rank and folded Rhat

The split normal-score calculation uses a between-chain variance estimate and average within-chain variance to form an estimated marginal variance. Their ratio produces Rhat. Similar locations can hide different chain scales, so a second calculation folds the draws around their pooled median before rank normalization. The larger diagnostic is the more conservative summary displayed for comparison.

Rhat can occasionally fall slightly below one because of finite-sample variance estimation. It should not be forcibly treated as an exact population ratio. Constant or otherwise degenerate chains can make required variances undefined; such cases need explicit handling rather than replacing a division by zero with a reassuring one. Inspect chain-specific information as well as the combined number.

Work through the supplied draw matrix

The default matrix contains four reproducibly generated chains with forty retained scalar draws each. Each chain is split into two twenty-draw halves. The same pooled ranks and folding convention are then used across all eight split chains. With average ranks and the stated normal-score transform, the maximum of the rank and folded diagnostics is approximately1.0095733513.

The example is deliberately modest in length so its complete input can be inspected. Its displayed Rhat is not a recommendation that forty draws per chain are adequate for a real analysis. Effective sample sizes, rank patterns and scientific features of the target distribution also matter, particularly if the decision depends on tail probabilities or rare transitions.

Understand bulk and tail effective sample sizes

Effective sample size compares a correlated chain summary with an idealized independent sample under the chosen estimator. Bulk ESS uses rank-normalized behavior across the main distribution. Tail ESS instead examines indicators associated with tail quantiles. A chain can mix reasonably near the center while producing little independent information about a distant tail region.

Autocorrelation estimates become noisy at long lags. A named paired-sequence truncation rule prevents summing arbitrary high-lag noise indefinitely. The resulting ESS is an estimate, not a literal count of different states and not the weight-only Kish effective size. Negative serial correlation can sometimes produce an estimated efficiency exceeding the number of retained draws.

Use checks that expose different failures

Shift one chain while leaving the others unchanged: between-chain disagreement should become visible. Scale a chain without shifting its center: the folded diagnostic should help expose that failure. A heavy-tailed example checks whether rank normalization behaves differently from an untransformed variance ratio. Constant chains and extensive ties require their own explicit diagnostic statuses.

Independent validation should compare a vetted posterior or ArviZ implementation using exactly the same split, rank and truncation conventions. Permuting chain order should not alter the summary. Permuting observations within chains is not an invariance for ESS, because it destroys the serial structure that ESS is designed to measure.

Treat a favorable diagnostic as necessary evidence

No collection of summary diagnostics proves convergence to the intended posterior. All chains might have missed the same mode, followed the wrong target density or been initialized in an unrepresentative region. Compare rank plots, traces, domain knowledge and sampler-specific warnings. A single threshold applied mechanically cannot substitute for checking the underlying computation.

Report the number of chains, retained length, warmup convention, rank/folding definition and ESS method with numerical results. If only one chain is available, a between-chain comparison is unavailable rather than solved by copying that chain several times. If chains have unequal retained lengths, prepare a justified common segment or use a method explicitly designed for that situation.

A few questions, answered

Does Rhatnear one prove convergence?

No. It is evidence about agreement among the entered chains, and all chains can still miss the same region or target the wrong distribution.

Can I shuffle draws to improve ESS?

No. Shuffling destroys the serial dependence being diagnosed and does not improve the information produced by the original sampler.

Why calculate a folded diagnostic?

Chains can share a similar center while having different scales. Folding around the pooled median helps expose that disagreement.

Is this the Kish ESS from weights?

No. This ESS estimates serial and between-chain simulation efficiency. Kish ESS is a different weight-concentration calculation.

Find your calculator

Start typing to explore the library.