Quantum measurements are estimates, not exact values, when a circuit is sampled with a finite number of shots. This guide shows how to convert counts into probabilities, calculate shot-noise error bars for expectation values, choose an appropriate confidence interval, separate sampling uncertainty from device noise, and record results so that every new circuit run can be compared fairly.
Overview
A quantum circuit produces a probability distribution over measurement outcomes. A real execution samples that distribution repeatedly, so two runs can produce different counts even when the circuit and backend have not changed. This variation is quantum shot noise, also called sampling uncertainty.
For a computational-basis measurement with outcomes 0 and 1, let n be the total number of shots and k the number of observed 1s. The estimated probability is:
p̂ = k / n
For a single-qubit Pauli-Z measurement, map outcome 0 to +1 and outcome 1 to −1. The estimated expectation value is then:
μ̂ = (N0 − N1) / n = 1 − 2p̂
where N0 and N1 are the measured counts. With finite shots, the standard error of this expectation estimate is approximately:
SE(μ̂) = √((1 − μ̂²) / n)
This formula describes sampling uncertainty under independent, identically distributed measurements. It does not capture all errors introduced by calibration drift, readout bias, crosstalk, gate imperfections, or an imperfect noise model. A small error bar therefore means that the sampling estimate is precise; it does not automatically mean that the estimate is close to the ideal quantum value.
For broader context, measurement uncertainty also matters in variational algorithms. In VQE, QAOA, and quantum machine learning, noisy objective estimates can influence an optimizer’s decisions. The same analysis applies whether results come from a simulator, a hardware provider, or a framework such as Qiskit or PennyLane.
How to estimate
1. Start with raw counts
Keep the counts and total shot count before calculating a probability. For example, suppose a circuit returns {"0": 7, "1": 3} from 10 shots. Then p̂(1) = 0.3, and the Z expectation estimate is 0.7 − 0.3 = 0.4.
Do not infer uncertainty from a rounded probability alone. The total number of shots is essential because the same probability can have very different reliability at 100 shots and 100,000 shots.
2. Calculate the standard error
For a binary observable with outcomes ±1, use the sample variance form:
SE = √((1 − μ̂²) / n)
The largest sampling uncertainty occurs near μ̂ = 0, where outcomes are most balanced. Estimates near +1 or −1 have lower shot noise because the observed outcomes are more uniform. A rough 95% interval can be formed as μ̂ ± 1.96 × SE, but this normal approximation can behave poorly with very few shots or estimates close to a boundary.
3. Select an interval for the quantity you report
| Quantity | Useful method | Practical caution |
|---|---|---|
| Binary probability | Wilson or exact binomial interval | Prefer these to a simple normal interval for small counts or probabilities near 0 and 1. |
| Pauli expectation, ±1 outcomes | Binomial interval transformed from probability, or a bounded proportion interval | Report the transformation clearly and keep the interval within the physical range when appropriate. |
| Multi-outcome distribution | Per-outcome intervals or a multinomial analysis | Many separate intervals require careful interpretation. |
| Weighted observable | Variance propagation or repeated-run bootstrap | Account for how terms were grouped and measured. |
| Device comparison | Matched shot budgets and repeated batches | Sampling intervals alone do not measure hardware drift or systematic bias. |
4. Extend the calculation to a Hamiltonian
Suppose an observable is decomposed as H = Σᵢ cᵢPᵢ, where each Pᵢ is a Pauli term. Estimate each term separately and combine them:
Ĥ = Σᵢ cᵢP̂ᵢ
If the terms are measured using independent shot groups, an approximate variance is:
Var(Ĥ) ≈ Σᵢ cᵢ² Var(P̂ᵢ)
For a ±1 Pauli term measured with nᵢ shots, use Var(P̂ᵢ) ≈ (1 − P̂ᵢ²) / nᵢ. If terms share shots or are grouped into commuting measurement circuits, covariance can matter. In that case, record the grouping strategy and use a covariance-aware calculation or resampling from the underlying shot data.
5. Decide whether more shots help
Shot noise decreases approximately with the inverse square root of the shot count. To reduce a sampling standard error by about half, plan for roughly four times as many shots, assuming other error sources remain unchanged. More shots are worthwhile when the decision margin is comparable to the current error bar, when an optimizer is responding to tiny objective changes, or when two candidate circuits have overlapping intervals.
More shots are less useful when repeated batches show a stable offset from an ideal simulator, when results drift over time, or when readout and gate errors dominate. Those cases call for calibration checks, noise characterization, circuit changes, or error-mitigation analysis rather than only a larger shot budget.
Inputs and assumptions
A repeatable uncertainty estimate should preserve more than the final expectation value. Log the following for every experiment:
- Circuit identity: a version, hash, or serialized circuit together with qubit count, depth, and measurement basis.
- Raw outcomes: counts for every relevant bitstring, not only a rounded probability.
- Shots: total shots per circuit, observable term, and measurement group.
- Estimate and interval: the expectation value, standard error, interval method, confidence level, and rounding policy.
- Execution conditions: simulator or hardware backend, noise model if present, transpilation or compilation settings, and execution time.
- Reproducibility details: software versions, random seeds where supported, parameter values, and mitigation or post-processing steps.
Make the statistical assumptions explicit. The formulas above assume that shots are sufficiently independent and that the reported observable is correctly mapped to measured outcomes. A simulator with an ideal statevector can provide an exact expectation value for the simulated state, while a finite-shot simulator still has sampling uncertainty. A hardware result can contain both shot noise and physical device noise. Compare like with like: use the same shot budget, circuit definition, observable grouping, and post-processing when testing a change.
A useful experiment record can follow this compact template:
run_id: 2026-11-05-example-01
circuit_version: ansatz-v3
backend: simulator-or-provider-name
shots: 10000
counts: {"0": 6200, "1": 3800}
observable: Z
estimate: 0.2400
standard_error: 0.0087
interval: 95% Wilson-transformed
seed: recorded-if-supported
noise_model: none-or-description
mitigation: none-or-descriptionWorked examples
Binary measurement
Assume 10,000 shots produce 6,200 zeros and 3,800 ones. The estimated Z expectation is:
μ̂ = (6200 − 3800) / 10000 = 0.24
The approximate standard error is:
SE = √((1 − 0.24²) / 10000) ≈ 0.009
A simple normal-style 95% interval is approximately 0.24 ± 0.018, or about [0.222, 0.258]. For publication-quality reporting, especially with small counts, calculate a binomial interval for the probability of outcome 1 and transform it to the Z scale. State the interval method instead of presenting the error bar without explanation.
Comparing two circuit runs
Suppose circuit A estimates an energy of −1.20 with a standard error of 0.02, while circuit B estimates −1.24 with a standard error of 0.02. The difference is −0.04. If the runs are independent, an approximate standard error for the difference is:
SEΔ = √(0.02² + 0.02²) ≈ 0.028
The improvement is therefore only about 1.4 standard errors under this simplified calculation. Treat it as inconclusive rather than declaring B better from the point estimates alone. Repeating matched runs, increasing shots, or using paired measurements can provide stronger evidence. Also check whether both estimates share a systematic device bias; a statistically clear difference can still be physically misleading if the backend conditions changed.
Observable with multiple Pauli terms
For an energy containing several terms, calculate each term’s estimate and variance, multiply each variance by the square of its coefficient, and combine the contributions. Terms with large coefficients or estimates near zero often deserve more shots. Adaptive shot allocation can improve efficiency, but it should be documented because changing allocations can make results harder to compare across iterations.
When to recalculate
Recalculate measurement statistics whenever the shot count, raw counts, circuit, observable grouping, backend, or post-processing changes. In a variational workflow, update the estimate and error bar for every parameter point that influences an optimization decision; do not reuse an old uncertainty value after the circuit or shot allocation changes.
Revisit the analysis after a framework or provider update if sampler or estimator interfaces, default shot behavior, result formats, transpilation settings, or measurement mitigation behavior may have changed. Keep a small regression circuit with known counts or a controlled simulator expectation so that an API migration does not silently alter the statistics pipeline. The implementation details of Qiskit, PennyLane, and provider execution models can change, so pin versions in recorded experiments and verify current documentation before copying an API-specific example.
Use this final checklist before trusting a result:
- Preserve raw counts and the exact shot total.
- Convert counts to probabilities and expectations with an explicit outcome convention.
- Choose an interval suited to the observable and sample size.
- Propagate uncertainty across weighted terms and account for covariance when needed.
- Separate shot noise from drift, readout bias, gate noise, and mitigation effects.
- Compare candidate circuits with matched conditions and uncertainty for the difference.
- Recalculate after every meaningful change to the circuit, backend, shot budget, or software stack.
These steps turn a quantum measurement from a single number into an auditable estimate. That makes simulator experiments easier to validate, hardware runs easier to compare, and optimization decisions less likely to be driven by sampling fluctuations.