Monte Carlo standard error 2026-10-20
The Monte Carlo standard error estimates the standard deviation of a simulation-based estimate across repeated simulation runs. For an average of independent random variables with finite variance , it is . Under a suitable central limit theorem for Markov chain Monte Carlo, correlated draws instead give the approximation , where is the effective sample size of a Markov chain for the particular estimated function . This measures numerical uncertainty in an estimate, not uncertainty in the unknown parameter itself.
The trace has long, slowly changing stretches, indicating strong autocorrelation and poor exploration of the posterior distribution. The reported effective sample size of a Markov chain is only , so the number of stored draws greatly exaggerates the information in the simulation. The potential scale reduction factor is appreciably above one and does not support convergence between chains. The reported Monte Carlo standard error is also large relative to a posterior mean near .
The exact beta distribution gives posterior mean and standard deviationso the simulation's reported spread is another warning. Do not interpret its mean or interval estimates as reliable yet. Run multiple chains from dispersed starts, improve and tune the proposal or sampler, and use longer runs after adaptation. Recheck the traces, potential scale reduction factor, and effective sample size of a Markov chain. More iterations help only if the chain actually explores its target well; thinning alone does not fix poor mixing.
Use several complementary Markov chain Monte Carlo convergence diagnostics, monitoring both and rather than judging the chain solely by its length:
- Trace plots of each parameter and the log-posterior against iteration, including early iterations and later windows. Look for initial drift, long flat stretches, abrupt switches and sustained changes in spread. Several independent chains started at dispersed points should explore the same region after burn-in.
- Plots of cumulative sample means and selected sample quantiles against iteration. Compare chains and successive long blocks; persistent movement indicates that the estimated posterior moments or tails have not stabilized.
- Autocorrelation function plots for both parameters after tentative burn-in. Slow decay reveals strong serial dependence and a small effective sample size of a Markov chain, even when iterations have been generated.
- Overlaid histograms or kernel density estimation curves from successive retained blocks and from different chains. Their agreement provides evidence of stable marginal posterior distributions.
- A scatter plot of retained pairs, colored by time block if helpful. Strong dependence or separate clusters can expose slow joint exploration that marginal plots conceal.
A million iterations and stable-looking plots do not prove convergence. Agreement across dispersed chains, exploration of all visible modes and adequate effective sample size of a Markov chain provide stronger evidence. Estimate the Monte Carlo standard error using the chain's autocorrelation; the independent random variables formula from 3(b)(ii) does not apply directly to these dependent draws.
Generate independent and identically distributed random variables with probability density function , evaluate for each draw, and return the Monte Carlo estimatorLinearity of expectation makes this an unbiased estimator: . Independence and the specified variance give . Its Monte Carlo standard error is therefore , and the strong law of large numbers gives convergence to almost surely.
Past exam of the systems biology course of the University of Cambridge 2024 Paper 3 2 f Solution 2026-10-20
TODO: Complete the data-specific numerical results and diagnostics when the original
Iris_data.csv is available.Estimate the posterior mean by averaging the retained states:The exact truncated normal distribution reference isFor a posterior well separated from zero, the truncation correction is tiny and the posterior mean is approximately , slightly below the sample mean.
The R continuation prints the Monte Carlo estimator, its approximate batch-based Monte Carlo standard error, and the exact value for comparison:
posterior_mean_mc <- mean(post)
posterior_mean_exact <- m + s * exp(dnorm(m/s, log = TRUE) -
pnorm(m/s, log.p = TRUE))
# Nonoverlapping batches account approximately for serial dependence.
batch_length <- floor(sqrt(length(post)))
number_batches <- floor(length(post)/batch_length)
used <- post[seq_len(batch_length * number_batches)]
batch_averages <- colMeans(matrix(used, nrow = batch_length))
mcse <- sd(batch_averages)/sqrt(number_batches)
cat("Posterior mean, MCMC =", posterior_mean_mc,
" approximate MCSE =", mcse, "\n")
cat("Posterior mean, exact =", posterior_mean_exact, "\n")The batch length must be long enough relative to the chain's dependence for this uncertainty estimate to be reliable. No numerical data-specific posterior mean is determined by the supplied paper alone.