Signature
r_MC = e_MC / s_post; ok_MC = (r_MC <= 0.05)
| Inputs | Definition | Unit |
|---|---|---|
e_MC | Monte Carlo error of the posterior mean of the parameter, which reflects both the number of simulations and the degree of autocorrelation, above zero | units of the parameter |
s_post | Standard deviation of the retained posterior draws of the parameter, above zero | units of the parameter |
r_MC | e_MC divided by s_post | proportion |
|---|---|---|
ok_MC | Equals 1 (TRUE) when r_MC is at most 0.05, 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
Monte Carlo error share and guideline flag from named cells
With the inputs in MonteCarloError and PosteriorDeviation, the formulas fill McErrorShare and McGuidelineFlag. A blank PosteriorDeviation is treated as 0 and returns #DIV/0!, and a blank MonteCarloError is treated as 0 and returns a share of 0 and a flag of 1, so both cells should be checked as filled.
=MonteCarloError/PosteriorDeviation; =IF(McErrorShare<=0.05,1,0)
Assumptions
Convergence assessed before the guideline is read
The draws come after burn-in on chains already judged to have converged, with both the burn-in and the retained sample reported, as NICE DSU Technical Support Document 2 asks. The ratio measures the precision of the mean only, and as the article notes, a converged run can still carry too much Monte Carlo error.
Guideline applied to each parameter of interest
The share is worked out for each parameter of interest separately, using the Monte Carlo error and standard deviation of that parameter on one scale, such as the log odds ratio. Technical Support Document 2 reports the 5% figure as an often cited guideline, not as a requirement of NICE.
Worked examples
Illustrative log odds ratio meeting the guideline
A log odds ratio with an illustrative posterior standard deviation of 0.10 and a Monte Carlo error of 0.004 has a share of 4%, within the guideline.
e_MC = 0.004; s_post = 0.10; r_MC = 0.04; ok_MC = 1
Illustrative log odds ratio missing the guideline
The same illustrative parameter with a Monte Carlo error of 0.008 has a share of 8%. Under the derived link, running on until the share halves would take about four times the effective draws.
e_MC = 0.008; s_post = 0.10; r_MC = 0.08; ok_MC = 0
Boundary case at exactly 5%
An illustrative Monte Carlo error of 0.05 with a posterior standard deviation of 1 sits exactly on the limit and counts as met, because the guideline says no more than 5%. The case checks an implementation.
e_MC = 0.05; s_post = 1; r_MC = 0.05; ok_MC = 1
Common errors
Dividing by the posterior mean in place of the standard deviation
The guideline is on the posterior standard deviation. With an illustrative posterior mean of minus 0.45, a standard deviation of 0.10 and a Monte Carlo error of 0.008, the error is 1.8% of the size of the mean and appears comfortable, while it is 8% of the standard deviation and misses the guideline. A mean near zero makes the mistaken share arbitrarily large (derived).
Working out the error as if the draws were independent
The standard deviation over the square root of the number of draws ignores autocorrelation. With an illustrative 20,000 draws, a standard deviation of 0.10 and an effective sample size of 200, that shortcut gives 0.0007 and a share of 0.7%, when the form of Bayesian Data Analysis equations 11.5 and 11.6 gives 0.0071 and a share of 7.1%, which misses the guideline (derived).
Reading the guideline as a test of convergence
Meeting 5% says the mean is precise for the chains as run. It does not show that the chains have mixed, which needs HE-FM-CON-001 on several chains. Technical Support Document 2 lists checking convergence and the size of the Monte Carlo error as separate points.
Sources
NICE DSU TSD 2 on the Monte Carlo error guideline
Dias S, Welton NJ, Sutton AJ, Ades AE. NICE DSU Technical Support Document 2: A generalised linear modelling framework for pairwise and network meta-analysis of randomised controlled trials. Sheffield: Decision Support Unit, ScHARR, University of Sheffield; 2011, last updated September 2016. Section 6, Technical issues in Bayesian MCMC (p. 38), states that an often cited guideline suggests that the Monte Carlo error, which reflects both the number of simulations and the degree of autocorrelation, should be no more than 5% of the posterior standard deviation of the parameters of interest, and that the burn-in and the posterior samples should be conservatively large and reported.
Bayesian Data Analysis on the variance of the mean of correlated draws
Gelman A, Carlin JB, Stern HS, Dunson DB, Vehtari A, Rubin DB. Bayesian Data Analysis. 3rd edition. Boca Raton: Chapman & Hall/CRC; 2013 (free electronic edition read). Section 11.5, Effective number of simulation draws, equations 11.5 and 11.6 (p. 286), gives the asymptotic variance of the average of correlated draws and the effective sample size as mn over 1 plus twice the sum of the autocorrelations. The link to the 5% guideline in HE-FM-CON-004 is derived from these equations.
Canonical Identity
Stable URI · Machine-readable · Resolvable · CC BY 4.0
