Statistical note
Autocorrelation: why adjacent time points aren't independent evidence
Nearby observations in a time series tend to resemble each other, which quietly shrinks the amount of independent information a long series actually contains.
Frame 42 of a live-cell movie looks a lot like frame 41 — the cell hasn’t teleported between them. That resemblance between nearby time points is autocorrelation, and it matters because most standard statistics (means, standard errors, confidence intervals) assume every observation is independent evidence. A 500-frame movie is not 500 independent pieces of information about the underlying process; it might contain only a handful of effectively independent snapshots, depending on how fast the thing being measured actually changes.
Measuring it
The autocorrelation at lag compares the series with a copy of itself shifted by steps:
near 1 means points steps apart are still highly similar (slow-changing process, strong dependence); near 0 means they’re essentially unrelated (fast-changing or noisy process). Plotting against — the autocorrelation function — shows how quickly that similarity decays as points get further apart.
import numpy as np
from scipy import stats
time = np.arange(8)
signal = np.array([1.0, 1.1, 1.3, 1.7, 2.0, 2.4, 2.7, 3.1])
trend = stats.linregress(time, signal)
residual = signal - (trend.intercept + trend.slope * time)
lag1_autocorr = np.corrcoef(residual[:-1], residual[1:])[0, 1]
print(f"slope={trend.slope:.2f} lag-1 residual autocorrelation={lag1_autocorr:.2f}")
Checking the residuals after removing an obvious trend, as above, is important — a shared upward trend alone will make almost any two nearby points look correlated even if the noise around that trend is independent. The autocorrelation that matters for uncertainty is the dependence left over after the trend is accounted for.
Why this shrinks your real sample size
If successive observations are strongly correlated, each new one adds less genuinely new information than an independent observation would — the effective sample size is smaller than the raw count of time points. Computing a standard error as if every frame were independent (dividing by with the raw frame count) systematically understates uncertainty and can turn noise into an apparently significant trend.
Worked example: a live-cell fluorescence trace
A 500-frame time-lapse trace of a single cell’s fluorescence intensity is not 500 independent measurements of “typical intensity” — it’s one continuous trajectory, and the frame-to-frame autocorrelation reflects both real biological dynamics and the camera’s temporal noise correlation. To compare intensity trends between two conditions honestly, either resample at intervals longer than the autocorrelation’s decay time before treating points as independent, or use a block bootstrap that resamples contiguous chunks of the series (preserving the local dependence structure) rather than individual time points.
Takeaways
- Autocorrelation measures how much a series resembles a lagged copy of itself; strong autocorrelation means nearby points carry redundant, not independent, information.
- Check autocorrelation on the residuals after removing an obvious trend — trend alone inflates apparent correlation between nearby raw values.
- The practical cost of ignoring autocorrelation is an understated standard error: a raw frame count used as if every frame were independent overstates precision and can manufacture a false trend.
- Use a lag-aware method (block bootstrap, or thinning the series to beyond the autocorrelation decay time) rather than a formula that assumes independence between adjacent points.