Signature
R_max = max(R_bulk, R_fold); use_draws = (R_max < 1.01) and (S_bulk > 400)
| Inputs | Definition | Unit |
|---|---|---|
R_bulk | Split-chain R_hat computed on the normal scores of the draws, which measures convergence of location | ratio, no unit |
R_fold | Split-chain R_hat computed on the normal scores of the folded draws, which measures convergence in the tails | ratio, no unit |
S_bulk | Effective sample size computed on the rank-normalised draws, the bulk-ESS of Vehtari and colleagues | draws |
R_max | Larger of R_bulk and R_fold | ratio, no unit |
|---|---|---|
use_draws | Equals 1 (TRUE) when R_max is below 1.01 and S_bulk is above 400, and 0 (FALSE) otherwise | binary indicator |
Function
Convergence checks on MCMC draws by split chains, rank normal scores and Monte Carlo error
Maps stored simulation output to the checks that show whether a Bayesian result has settled. For one scalar estimand it returns the split-chain potential scale reduction factor R_hat from split-chain means and variances (HE-FM-CON-001, with HE-CF-CON-001 for stored draws), the folded draw and rank fraction behind the rank-normalised version (HE-FM-CON-002), the conservative reported value with its use rule (HE-FM-CON-003) and the ratio of Monte Carlo error to posterior standard deviation (HE-FM-CON-004). The precision of independent probabilistic runs is live and is not restated. HE-FN-PSA-001 sets out the Monte Carlo standard error of a mean as the form of HE-FM-ANTV-002 with one observation per draw, HE-CF-PSA-001 computes it, the standard error of a share of runs has the form of SE_p in HE-FM-BINOM-004, an interval around the mean is HE-FM-AN-001, and the draws needed for a target standard error are HE-FM-ABM-003 and HE-FM-ABM-004. The article's sizing example applies these records, its 14,400 runs being HE-FM-ABM-003 with s_run 12,000 and e_target 100, and its 6,147 runs the same record with e_target 300 / 1.96, rounded up. The effective sample size has its own concept page and enters here as an input. Notation follows the Convergence article.
Try this function
Implementations
Excel
Reported R-hat and use flag from named cells
With the inputs in RankNormalisedRhat, FoldedRhat and BulkEffectiveDraws, the formulas fill ConservativeRhat and UseDrawsFlag. MAX ignores a blank cell, so a missing folded value reports the rank-normalised value alone, and two blank R-hat cells give 0, which meets the first condition, so both should be checked as filled. A blank BulkEffectiveDraws counts as 0 and returns a flag of 0.
=MAX(RankNormalisedRhat,FoldedRhat); =IF(AND(ConservativeRhat<1.01,BulkEffectiveDraws>400),1,0)
Assumptions
At least four chains and enough draws per split chain
Vehtari and colleagues recommend at least four chains by default and rely on the statistic only if each split chain has an average effective sample size of at least 50. With four chains split in half, that is the total of 400 in the rule. More chains raise that total (derived), while the line keeps the printed 400.
Rule applied to every parameter that feeds the economic model
The check is run on each scalar parameter, and the line handles one. The article asks for the effective sample size checks to pass for every parameter that feeds the economic model. When quantiles or intervals are reported, Vehtari and colleagues also advise assessing convergence for those quantiles with a tail effective sample size.
Thresholds as first-level checks
Vehtari and colleagues describe 1.01 and 400 as numerical targets for first-level checks that should be adapted as necessary for the application, with domain expertise used to check that Monte Carlo standard errors are small enough. A pass is therefore a condition for use and not a finished review.
Worked examples
Illustrative parameter passing both conditions
A parameter with an illustrative rank-normalised value of 1.004, a folded value of 1.006 and a bulk effective sample size of 820 reports 1.006 and passes.
R_bulk = 1.004; R_fold = 1.006; S_bulk = 820; R_max = 1.006; use_draws = 1
Illustrative parameter failing on its tails
With illustrative values, the rank-normalised value of 1.003 would pass, but the folded value of 1.012 is reported and fails.
R_bulk = 1.003; R_fold = 1.012; S_bulk = 820; R_max = 1.012; use_draws = 0
Illustrative parameter failing on its effective sample size
With illustrative values, both R-hat values pass, but a bulk effective sample size of 310 is too low for the variances and autocorrelations behind them to be reliable.
R_bulk = 1.002; R_fold = 1.004; S_bulk = 310; R_max = 1.004; use_draws = 0
Boundary case at exactly 1.01
An illustrative reported value of exactly 1.01 fails because the source writes the condition as below 1.01. The case checks that an implementation keeps the strict inequality.
R_bulk = 1.01; R_fold = 1.005; S_bulk = 820; R_max = 1.01; use_draws = 0
Common errors
Reporting the rank-normalised value without the folded one
Vehtari and colleagues note that both plain and rank-normalised split R-hat can be fooled by chains with one location and different scales. On the illustrative table in HE-CF-CON-001 both are 0.9129 and only the folded value, 1.0239, exceeds 1.01 (computed here).
Using the bulk effective sample size to work out a Monte Carlo standard error of the mean
Vehtari and colleagues state that, because of rank normalisation, bulk-ESS is no longer directly applicable to estimating the Monte Carlo standard error of the posterior mean. It is a check on the sample in this rule. HE-FM-CON-004 takes the Monte Carlo error reported for the parameter itself.
Sources
Vehtari and colleagues on the reported maximum and the use rule
Vehtari A, Gelman A, Simpson D, Carpenter B, Bürkner PC. Rank-normalization, folding, and localization: an improved R-hat for assessing convergence of MCMC. arXiv:1903.08008v5. Published as Bayesian Analysis. 2021;16(2):667-718, doi:10.1214/20-BA1221 (published version not seen). Preprint section 2, Recommendations for practice, proposes only using the sample if the value is below 1.01, recommends at least four chains and a rank-normalised effective sample size greater than 400, and calls these numerical targets first level checks to be adapted as necessary. Preprint section 3.2 relies on the statistic only if each split chain has an average effective sample size of at least 50, and says that in the minimum setup of four chains the total should be at least 400, where section 2 writes greater than 400. Preprint section 4.1 says that bulk-ESS is not directly applicable to the Monte Carlo standard error of the posterior mean. Preprint section 4.2 proposes reporting the maximum of the rank-normalised and folded values for each parameter.
Canonical Identity
Stable URI · Machine-readable · Resolvable · CC BY 4.0
