research30 min studyLesson 942 in Physics

Autocorrelation times and effective sample size

Compute an observable-specific error inflation and distinguish long-run variance from a nominal configuration count.

On this page

What you’ll understand

  • Use the one-half convention for integrated autocorrelation time.
  • Compute the variance and effective sample size of an equilibrated mean.
  • Explain why blocking and nonlinear estimators need matched resampling.

Saving a thousand configurations does not necessarily provide a thousand independent measurements. A local algorithm may preserve a long-wavelength fluctuation through many sweeps, so adjacent measurements carry overlapping information. Autocorrelation is specific to both the observable and the update rule. Energy, magnetization, and a rare topological quantity can therefore have very different error budgets on the same trajectory. We assume an equilibrated stationary process with finite variance and a sufficiently summable correlation tail before using the long-run formulas in this lesson.

Fix the convention before quoting a time

For an observable O recorded at equally spaced update intervals, subtract its equilibrium expectation and define the covariance at lag t. Normalize by the zero-lag variance to obtain rho. We use integrated autocorrelation time equal to one half plus the positive-lag sum. Independent measurements then have tau equal to one half, not one. Some authors instead call twice this quantity the autocorrelation factor; copying a quoted number without its definition creates a factor-of-two error in the reported uncertainty.

The exponential relaxation time measures an asymptotic decay rate of slow modes, whereas the integrated time weights their amplitudes in this particular observable. A small-amplitude slow tail may scarcely affect a short plot yet matter for a precise error estimate. Negative correlations can lower the integrated time below one half and give a variance-based effective size above the number stored. That mathematical possibility does not create additional independent configurations or justify ignoring stationarity and tail-estimation assumptions.

ΓO(t)=⟨(O0−μ)(Ot−μ)⟩,ρO(t)=ΓO(t)ΓO(0),τint,O=12+∑t=1∞ρO(t)\Gamma_O(t)=\langle(O_0-\mu)(O_t-\mu)\rangle,\qquad \rho_O(t)=\frac{\Gamma_O(t)}{\Gamma_O(0)},\qquad \tau_{\mathrm{int},O}=\frac12+\sum_{t=1}^{\infty}\rho_O(t)
t and tau are measured in the declared interval between stored measurements. Gamma has O² units, rho is dimensionless, and the infinite sum requires a controlled correlation tail.↔ Scroll wide equations horizontally.

Long-run variance controls the error of a mean

The exact finite-length variance of the mean contains a triangularly weighted sum over all lags. When the run is much longer than its relevant correlation scale, replacing those weights by one gives the common asymptotic variance formula. Effective sample size is defined by comparing this variance with that of independent measurements having the same marginal variance. It is therefore a diagnostic for estimating this observable’s mean, rather than a universal property attached permanently to a saved file.

Increasing the measurement spacing can reduce correlation between stored entries, but it also discards information already paid for unless storage or measurement cost is the bottleneck. Efficiency should be compared using uncertainty per total computational cost. A longer run reduces statistical uncertainty only after thermalization and mixing are credible. An apparently small estimated autocorrelation time from a chain trapped in one sector cannot account for the missing sector; within-sector fluctuations alone underestimate the full uncertainty.

Var⁡(O‾)=ΓO(0)n[1+2∑t=1n−1(1−tn)ρO(t)]≃2τint,OΓO(0)n,neff=n2τint,O\operatorname{Var}(\overline O)=\frac{\Gamma_O(0)}n\left[1+2\sum_{t=1}^{n-1}\left(1-\frac tn\right)\rho_O(t)\right]\simeq\frac{2\tau_{\mathrm{int},O}\Gamma_O(0)}n,\qquad n_{\mathrm{eff}}=\frac n{2\tau_{\mathrm{int},O}}
The first equality assumes stationarity; the approximation requires n large relative to the correlation scale. n_eff describes long-run variance for O and is not a replacement for equilibration checks.↔ Scroll wide equations horizontally.

Estimate errors without treating derived quantities independently

A practical autocorrelation sum needs a window: including too few lags loses the tail, while including arbitrarily many mostly noisy lags destabilizes the estimate. Vary the window and examine stability, ideally using independent replicas as additional checks. Blocking offers another diagnostic: combine consecutive measurements into blocks longer than the relevant correlation scale and estimate the uncertainty from their means. Increasing the block size leaves fewer blocks, so a seeming plateau with only a handful remaining can itself be statistically weak.

For a nonlinear ratio such as a Binder cumulant or a reweighted mean, its ingredients fluctuate together. A block jackknife or bootstrap must resample the same blocks for all ingredients and recompute the complete ratio or fit each time. Resampling individual correlated measurements as if independent defeats the purpose. These methods control sampling uncertainty and some finite-sample bias; they do not repair an incorrect action or an unsampled phase. The exact Markov lab illustrates a relaxation eigenmode without generating a stochastic history from which to estimate an error.

SE⁡^(O‾)=sB2B,sB2=1B−1∑b=1B(O‾b−O‾)2\widehat{\operatorname{SE}}(\overline O)=\sqrt{\frac{s_B^2}{B}},\qquad s_B^2=\frac1{B-1}\sum_{b=1}^{B}(\overline O_b-\overline O)^2
This blocking estimate treats B equal-length block means as approximately independent. It requires blocks long enough to suppress remaining interblock correlation and enough blocks to estimate their variance.↔ Scroll wide equations horizontally.

A geometric autocorrelation tail

An equilibrated observable has marginal variance four and exact normalized correlations ρ(t)=0.6t\rho(t)=0.6^t. For 1000 stored measurements, calculate integrated time, effective sample size, and the asymptotic standard error.

  1. The positive-lag geometric sum is 0.6/(1−0.6)=1.50.6/(1-0.6)=1.5. With the declared one-half convention, τint=0.5+1.5=2\tau_{\mathrm{int}}=0.5+1.5=2.

  2. The variance inflation is twice tau, namely four. Thus the variance-based effective sample size is 1000/4=2501000/4=250, although the file still contains 1000 measurements.

  3. The asymptotic mean variance is 4×4/1000=0.0164\times4/1000=0.016, so its standard error is 0.016≃0.12649\sqrt{0.016}\simeq0.12649 in the observable’s units. This uses the supplied exact stationary tail and a long-run approximation.

The result

The integrated time is two measurement intervals, effective size 250, and asymptotic standard error about 0.1265.

Explore the model

Interactive lab

Interactive lab · markov

Compare two exact relaxation modes

Reset and set p=0.1p=0.1, q=0.1q=0.1; Step twice to two transitions and predict state-one probability 0.18. Repeat from Reset with both controls p=0.5p=0.5, q=0.5q=0.5 and two Steps; predict 0.5. The nonstationary eigenvalues are respectively 0.8 and zero. These exact probability evolutions illustrate persistence but do not produce sampled trajectories or an autocorrelation-time readout.

Compare two exact relaxation modesExact finite-step probabilities for a two-state chain starting in state 0, not sampled trajectories. Playback advances two transitions per second. When p = q = 0 every distribution is stationary; when p = q = 1 the chain alternates forever. A single zero transition creates an absorbing state. Current readings: P(state 1) at step 0: 0%; Stationary P(state 1): 60%; Chain behavior: Monotone convergence. All parameters are adjustable with the labeled controls below.Two-state Markov distribution after 0 steps: state zero probability 1, state one probability 0.Initial distribution (1, 0) · step 0p = 0.3q = 0.201100%0%1−p1−qP(0)P(1)Monotone convergence
P(state 0)P(state 1)Stationary distribution
P(state 1) at step 0
0%
Stationary P(state 1)
60%
Chain behavior
Monotone convergence
t = 0 s

Exact finite-step probabilities for a two-state chain starting in state 0, not sampled trajectories. Playback advances two transitions per second. When p = q = 0 every distribution is stationary; when p = q = 1 the chain alternates forever. A single zero transition creates an absorbing state. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forA stationary distribution can be identical while the approach to it differs substantially.

Check your understanding

In the convention tau_int = 1/2 + sum of positive-lag correlations, what value describes independent measurements?

Try it yourself

Four equal-length block means are 1, 3, 2, and 4. Assuming these block means are independent, calculate the overall mean and the blocking standard error. Each block contains ten original measurements.

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

Use the sample variance of the four block means with denominator three; do not divide again by the forty raw entries.

Compare with the solution

The mean is 2.5. Squared deviations sum to 2.25+0.25+0.25+2.25=52.25+0.25+0.25+2.25=5, giving block sample variance 5/35/3. The mean’s estimated variance is (5/3)/4=5/12(5/3)/4=5/12, hence standard error 5/12≃0.6455\sqrt{5/12}\simeq0.6455. Dividing by forty instead of four would count the block averaging twice. With only four blocks this estimate is noisy, and its assumption of negligible interblock correlation still needs independent justification.

Take it with you

  • Autocorrelation conventions must accompany every reported time or effective sample size.
  • Errors depend on an observable’s integrated covariance, not simply the number of configurations.
  • Blocking and joint resampling preserve the correlations needed for nonlinear observables and fits.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.