Effective sample size of a stationary sample 2026-10-06
When the long-run variance of a stationary process is positive, matching the variance of its average to an average of independent observations gives . Positive aggregate correlation reduces this size; negative aggregate correlation can increase it beyond the observation count. This extends the variance interpretation of effective sample size of a Markov chain.
Integrated autocorrelation time 2026-10-05
For a stationary Markov chain and a scalar observable with summable autocorrelation function , the asymptotic variance of its sample mean is . Thus the effective sample size of a Markov chain is approximately . Different observables can have very different autocorrelation times.
MCMC trace diagnosis and proposal tuning 2026-10-14
A trace of a Markov chain Monte Carlo parameter helps distinguish slow movement, long rejection plateaus, and movement between separated regions. Very small random-walk proposals give high acceptance but slow diffusion; very large proposals produce low acceptance and repeated states. Record acceptance rates alongside trace plots and effective sample size of a Markov chain before deciding which scale to change. Correlated posterior directions often benefit from block proposals with a covariance fitted during a preliminary tuning run. A trace alone cannot prove convergence or identify the unique cause of poor movement; dispersed chains and stationary summaries provide additional evidence. Freeze tuning before the main sampling phase, or use adaptation satisfying an appropriate ergodicity theorem.
Past exam of the mathematics course of the University of Cambridge 2003 iii Paper 43 3 c Solution Created 2026-10-03 Updated 2026-10-14
The marginal Metropolis–Hastings algorithm avoids storing allocation labels, but each component update changes every mixture likelihood term. Cache component contributions, calculate log-likelihoods stably and tune the proposal scale and random-walk Metropolis efficiency during a pilot run; then fix proposal scales or use a justified adaptive scheme. Means and variances may be strongly dependent, making separate random walks inefficient. Weight proposals must respect the simplex, variance proposals must respect positivity, and the displayed acceptance ratios must retain all relevant priors and proposal corrections.
The augmented Gibbs sampler uses elementary conditionals and typically costs order for a label sweep, followed by sufficient-statistic updates. It avoids Metropolis rejections in these conditional draws, but does not remove slow mixing: ambiguous allocations can lock means, variances and labels into strongly coupled configurations. Empty components must be updated from their priors, not deleted automatically. The proper inverse-gamma scale suppresses arbitrarily small variances even though an unregularized Gaussian-mixture likelihood can be singular.
With exchangeable component priors, label switching creates equivalent posterior modes. Ordering component means is an identification constraint, not an innocuous change unless the intended inferential model is made explicit. Predictive density and permutation-invariant summaries avoid arbitrary labelling; component-specific summaries require an appropriate relabelling convention. If the Dirichlet parameters differ between components, exact label symmetry may be broken, but substantial multimodality can remain.
Use dispersed initial states, multiple chains and diagnostics on several scientifically relevant functions. Report effective sample size of a Markov chain and Monte Carlo error estimates, not just a large iteration count. Burn-in can reduce initialization bias but does not prove convergence; thinning cannot by itself cure poor exploration. Closed-form Gibbs updates simplify computation, while reliable inference still requires adequate exploration of the posterior.
Past exam of the mathematics course of the University of Cambridge 2005 iii Paper 47 5 a i Solution Created 2026-10-03 Updated 2026-10-14
Convergence means that the chain's distribution approaches the intended posterior, independently of its initial state, under the relevant ergodicity assumptions. It is separate from obtaining enough effectively independent draws for a precise answer. Start several chains at dispersed plausible points, examine trace plots and stability of posterior summaries, compare between-chain and within-chain variation, and inspect autocorrelation and effective sample size of a Markov chain. Discard an initial transient when appropriate and report Monte Carlo uncertainty.
No finite diagnostic proves convergence. Agreement among chains started in the same basin can miss another mode. If different starting points give incompatible summaries, extend runs or improve proposals rather than merely deleting more observations. Extra thinning does not repair poor exploration; retaining all post-transient draws usually preserves more information for estimating uncertainty.
Past exam of the mathematics course of the University of Cambridge 2009 iii Paper 36 3 c Solution Created 2026-10-03 Updated 2026-10-14
Centre and scale both predictors, particularly the raw dose whose scale is much larger than that of . For example use , and the linear predictor . This reduces the intercept-slope correlations and numerical scale disparities; further orthogonalizing correlated columns or updating coefficients jointly can improve Markov chain Monte Carlo mixing. The exact old prior can be retained through the corresponding coefficient transformation; assigning new independent priors to transformed coefficients would instead change the prior.
For weakly informed plate effects or small , use the non-centred Gaussian random-effect parameterisation with . This often reduces dependence between the scale and local effects; it is not guaranteed to outperform the centred version when plate effects are strongly informed. Sensibly calibrated proper priors also avoid the enormous initial log intensities permitted by the stated coefficient ranges. Use dispersed chains and Markov chain Monte Carlo convergence diagnostics to assess stationarity, agreement between chains and effective sample size of a Markov chain. Reparameterization can improve mixing; simply retaining more iterations does not remove poor mixing.
Past exam of the mathematics course of the University of Cambridge 2009 iii Paper 40 5 d Solution Created 2026-10-03 Updated 2026-10-14
Tune the proposal scale using pilot runs on a grid of candidate values. After allowing for initial transients, compare the effective sample size of a Markov chain per unit computation time for representative functions, such as both coordinates and a quadratic function. Equivalently inspect their integrated autocorrelation time, using . Choose a useful scale and keep it fixed for the production run. Another pilot criterion is the average squared accepted displacement, possibly in coordinates standardized by the target covariance, which balances move size and rejection.
Acceptance alone is not an efficiency criterion. As , proposals are almost the current state, so acceptance tends to one while exploration becomes arbitrarily slow. Very large scales propose mostly low-density states and produce long sequences of identical values. The proposal scale and random-walk Metropolis efficiency trade-off requires both movement and acceptance; neither maximizing nor merely reporting the acceptance probability guarantees a useful sample. With strong correlation, an isotropic proposal also struggles with the target's narrow direction; covariance-scaled proposals can improve this geometry beyond tuning one scalar variance.
Past exam of the mathematics course of the University of Cambridge 2010 iii Paper 36 4 b Solution Created 2026-10-03 Updated 2026-10-14
Center the log-time predictor and the baseline log measurement near their sample means, so the intercept describes a typical predictor configuration. This reduces intercept-slope posterior correlation and can improve Markov chain Monte Carlo mixing. If exactly the original model is required, transform the intercept prior consistently when changing coordinates rather than silently assigning a different independent prior.
For weakly informed child effects, a non-centered Gaussian random-effect parameterization can also help:This retains the same conditional prior distribution for but removes its prior-scale dependence from the sampled . It can reduce strong dependence between the effects and . A centered parameterization can be better when each child's effect is very accurately observed, so improvement is not automatic. Blocking strongly correlated coefficients is another option. Check the resulting chains with Markov chain Monte Carlo convergence diagnostics and effective sample size of a Markov chain, rather than judging convergence from the number of iterations alone.
Past exam of the mathematics course of the University of Cambridge 2015 iii Paper 37 5 b Solution Created 2026-10-03 Updated 2026-10-06
A convenient general-state-space ergodic theorem is the following. For a positive Harris recurrent Markov chain with invariant probability measure , and a measurable function with ,Here is the stationary expected value. Harris recurrence means that every set of positive irreducibility measure is visited almost surely from every state; positive recurrence supplies an invariant probability rather than only an infinite invariant measure. The ergodic theorem for a positive Harris recurrent Markov chain holds from any starting state under these Harris hypotheses. aperiodicity is not necessary just for averages.
A useful sufficient form of the central limit theorem for a geometrically ergodic Markov chain adds aperiodicity, geometric ergodicity, and for some . It givesThese are sufficient hypotheses, not a claim that irreducibility alone ensures a central limit theorem. The Markov chain Monte Carlo asymptotic variance uses stationary covariances , with . The series is absolutely convergent under the stated sufficient assumptions. If , write and , where the integrated autocorrelation time is . When , the effective sample size of a Markov chain is approximately . Negative correlations can reduce the asymptotic variance; a zero asymptotic variance gives a degenerate normal limit. For constant , variance is zero and the autocorrelation normalization is undefined.
Past exam of the mathematics course of the University of Cambridge 2016 iii Paper 208 6 d Solution Created 2026-10-03 Updated 2026-10-14
Use the ergodic theorem for a positive Harris recurrent Markov chain: for an invariant distribution and an integrable function , the time average converges almost surely to under the usual ergodicity conditions. This is the relevant theorem for correlated Metropolis–Hastings algorithm output, rather than the strong law of large numbers. Here is integrable. Indeed, puttingwe have , which bounds the unnormalized density by a constant times an integrable Gaussian density and also gives finite first moments.
For a proposal scale , initialize anywhere in . At each step draw independent random variables with the standard normal distribution and an independent uniform , propose , and accept whenOtherwise set . The normal proposal is symmetric, so its density cancels; the target normalizing constant also cancels. Include every state in the average, including repeated states after rejection. The ergodic theorem for a positive Harris recurrent Markov chain then givesA fixed discarded initial segment does not change this limit.
Small proposal variance gives high acceptance but tiny moves and strong serial dependence. Large variance gives more ambitious moves, but many proposals enter very low-density regions and are rejected, creating long runs at one state. An intermediate scale should be assessed by exploration and effective sample size of a Markov chain, not acceptance rate alone.
This density has two modes, at and their interchange. To see this, stationary points satisfy , implying either or . The unequal solutions have and are local minima of ; the equal solution is a saddle. Mode switching is therefore a material part of proposal-scale selection: a chain confined to one mode can have high acceptance and a misleading finite-run estimate.
Two modes of the quartic target density, with the diagonal saddle between them, explaining slow mode switching in random-walk Metropolis-Hastings
. Details. Past exam of the mathematics course of the University of Cambridge 2018 iii Paper 219 2 iv Solution Created 2026-10-03 Updated 2026-10-05
A log-flat improper prior is not appropriate when all known are positive: the integrated likelihood in (iii) has a positive finite limit as , so its integral against diverges. One defensible noninformative choice is the scalar Jeffreys prior for an additive variance component, calculated holding the mean parameters fixed:Indeed the normal variance score has information . This is a scalar conditional-information prior, not a claim that its product with the flat mean prior is the joint Jeffreys prior. It is bounded near zero and is at infinity. The integrated likelihood is uniformly bounded near zero and is bounded by a constant times at infinity, independently of the mean-shape parameters, since . Thus and a proper external prior on the physically admissible ensure posterior propriety. Proper weak scale priors are another option. If known errors vanish, the boundary argument and appropriate prior need separate reconsideration.
For an efficient parameterization, use with and . A chain on this joint reduced parameter space targetsThe factor is the Jacobian determinant. At each iteration propose , with for a fixed nonsingular proposal covariance, and accept with probability . Proposals outside the physical prior domain have target zero. Tune during warmup and freeze it for the retained Random-walk Metropolis algorithm. To obtain samples of the full original parameter vector, independently draw from its retained positive prior and reconstruct ; the resulting vector is . Analytically marginalizing using (iii) would also be valid.
Use several dispersed chains, trace plots, rank-normalized split , and the effective sample size of a Markov chain for each parameter and for . These Markov chain Monte Carlo convergence diagnostics reveal poor mixing and disagreement but do not prove convergence. Estimate the integrated autocorrelation time ; with retained draws, . Default to no thinning of a Markov chain, so the thinning factor is . If storage requires thinning, choose a spacing after inspecting the autocorrelation and verify the retained-chain effective sample size; no finite spacing guarantees independent draws.
Using the retained samples, computeThese are posterior summaries, provided the corresponding moments exist, not uncertainties of the numerical estimates. A proper prior alone does not ensure finite second moments; choose or check the external prior accordingly. The Monte Carlo standard error of the posterior mean is approximately .
Past exam of the mathematics course of the University of Cambridge 2018 iii Paper 219 4 iii c Solution Created 2026-10-03 Updated 2026-10-05
Keeping the powers and exponentials of and in the joint kernel gives the two inverse-gamma distributions, using the printed shape–scale convention:Indeed their kernels are and . With positive measurement variances and generic continuously drawn latent values, the two scale parameters are positive almost surely. Together with (a),(b), these are all formal full conditional updates.
There is, however, no joint posterior probability distribution to sample under the stated priors. Integrate out the intrinsic first. For fixed , the observational marginal density iswhere is the centred normal density of variance . Substitute . Dominated convergence givesThe convergence is uniform on any compact interval and any compact positive interval, since the normal densities are uniformly bounded and continuous there. Hence some such region has for all sufficiently small , andIntegrating over those positive-measure intervals proves that the full normalizing constant is infinite. If all , the boundary also gives a positive marginal likelihood and a divergent integral at fixed . Thus , even though its generic full conditionals are proper. Apparent stability of a simulated chain cannot establish a nonexistent stationary probability law.
A valid repair that preserves direct sampling is to replace the two log-flat priors by independent proper and , with all four constants positive. The normal and truncated-normal updates remain as above, whileWith positive , the flat prior is then harmless: after integrating it out, the Gaussian measurement likelihood is bounded uniformly over the latent shifts and the scales, and the remaining proper priors integrate to one. A proper prior on is also possible.
For this repaired model, initialize , and finite . Repeatedly choose one of the coordinates with fixed positive probabilities and redraw from its full conditional using the latest values. This Random-scan Gibbs sampler preserves the proper target and satisfies detailed balance: for each coordinate, both forward and reverse flows equal the marginal density of the remaining coordinates times the product of the two conditional densities. A systematic full sweep is another invariant scheme, though it need not itself be reversible.
Run several dispersed chains; inspect traces of both scales, , representative latent values and the log posterior. Assess rank-normalized split , autocorrelation, and the effective sample size of a Markov chain, and extend runs until relevant Monte Carlo errors are sufficiently small. Scale–latent dependence can cause slow mixing, so diagnostics must include boundary exploration and alternative initializations. Keep post-warmup draws without automatic thinning. These are convergence checks for the repaired posterior; the printed model admits only the formal update algorithm, not a valid posterior-sampling interpretation.
Past exam of the mathematics course of the University of Cambridge 2019 iii Paper 219 3 c Solution 2026-10-03
Use broad proper uniform priors for , , and over physically plausible ranges, and broad log-uniform priors for the positive scales and . ThenA Random-walk Metropolis algorithm can update with a multivariate Gaussian proposal distribution. Initialize several dispersed chains near plausible cross-correlation delays and near the marginal-likelihood optimum; reject proposals outside the prior bounds; discard warm-up while adapting only the proposal scale and covariance; then freeze the kernel and retain a long run. Evaluate trace plots, autocorrelations, acceptance rates, between-chain agreement, and the effective sample size of a Markov chain. Posterior predictive quasar light curves provide a model check.
Past exam of the mathematics course of the University of Cambridge 2026 iii Paper 219 3 b Solution Created 2026-09-24 Updated 2026-09-25
With and ,A Random-walk Metropolis algorithm proposes from a symmetric multivariate normal increment, conveniently using logarithmic coordinates for , and accepts with probabilityAfter burn-in, retain a suitably long chain and assess convergence and effective sample size of a Markov chain.
A small proposal scale increases acceptance while making successive states almost equal. A large scale often proposes low-density states and creates long rejection runs. A pilot comparison can optimize effective sample size of a Markov chain per unit computing time, or expected accepted squared displacement, rather than acceptance alone. Tune on representative functions and then fix the scale for production; an arbitrarily history-dependent adaptation is not automatically a chain with the desired invariant distribution.
Thinning of a Markov chain 2026-10-05
Thinning keeps every th state of a Markov chain. The retained chain has transition kernel and the same stationary distribution. It is generally still dependent, and reducing correlation between retained draws does not by itself improve precision per original transition. Keep all post-warmup draws unless storage or later processing requires thinning; assess precision using the effective sample size of a Markov chain.
