Home / Blog / Math & Scientific

Math & Scientific

Calculate Sample Size from a Confidence-Interval Target

Turn interval width into a margin, derive sample targets for proportions and means, and explain why a published interval may not reveal a unique count.

Calculate Sample Size from a Confidence-Interval Target

Clarify whether the interval is planned or already observed

A desired future interval width can be used to plan a sample under a specified statistical model. A published interval can sometimes be used to approximate the count behind it, but only if its construction and other inputs are known. These are different problems. A confidence level and width by themselves do not identify one universal sample size, because uncertainty also depends on variability, the parameter being estimated and the sampling design.

Convert full width into a one-sided margin

For a symmetric interval centred at 0.5 with endpoints 0.45 and 0.55, the full width is 0.10 and the margin e is 0.05. The sample-size formula uses that half-width. Entering 0.10 as e would understate the target by a factor of four because e is squared in the denominator. In the local form, the margin field uses percentage points, so enter 5 rather than the probability-scale value 0.05 for this example.

Plan a proportion interval

For a large-population normal approximation, e=z√[p(1−p)/n]. Solving gives n=z²p(1−p)/e². At 95% confidence, p=0.5 and e=0.05, use z=1.96 to obtain 384.16 and round upward to 385. This plans an approximate interval using an assumed proportion. It does not guarantee every sample will produce that exact width, particularly if the final analysis uses Wilson, exact binomial or another interval construction rather than this simple normal approximation.

Check a second proportion target

Suppose a relevant prior estimate is p=0.4 and the desired full interval width is eight percentage points. The margin is four points, or e=0.04. With 95% confidence, n=1.96²×0.4×0.6/0.04²=576.24, rounded up to 577. The public form fixes the proportion at 50%, so it cannot directly verify the 40% assumption. Entering margin 4 there instead gives 601, the more conservative 50% planning target. If no credible prior proportion is available, p=0.5 gives the largest value within this formula and a different target, so the prior assumption should be documented.

Use the corresponding formula for a mean

For a mean with a known population SD σ, the normal margin is e=zσ/√n. Rearranging gives n=(zσ/e)². If σ=10 measurement units, e=2 units and z=1.96, the result is 96.04, so at least 97 observations are planned. This is a mean calculation, not a proportion calculation; the local sample-size form does not have an SD field. If σ is estimated and a t interval is intended, its critical value depends on n, requiring an appropriate iterative or dedicated planning method.

Understand reverse calculations from a reported interval

Suppose a known-SD normal mean interval has centre 50 and endpoints 48.04 and 51.96, and σ=10 was used. Its margin is 1.96, so solving (1.96×10/1.96)² gives n=100. But a similar printed interval could arise from a t method, design adjustment, transformed scale or rounded endpoints. Without the method and spread information, the sample count is not uniquely determined. Treat a reverse estimate as conditional on those facts rather than an automatic recovery of missing study details.

Keep sampling corrections separate

A finite-population correction changes the relationship between margin and count when sampling without replacement from a known finite population. Clustered designs and unequal weights can change the standard error in other ways. The simple inverse formulas above assume their stated independent-observation models. A narrow published interval is not evidence that a large number of independent observations was collected; it could reflect a different estimator, external information or an incorrect uncertainty calculation.

Record rounding and the final analysis plan

Round a planned observation count upward after carrying sufficient precision through the calculation. Do not round an estimated proportion or SD aggressively before squaring, because it can change the target. State the confidence level, half-width, variability assumption, model and any adjustments alongside the count. Once data are collected, calculate the actual interval from the observed data and chosen method. The planning target sets an expectation for precision; it is not a replacement for that final uncertainty analysis.

Calculator for the supported step

The local form calculates the single-proportion planning cases at its fixed 50% assumption, using confidence and margin inputs. It does not solve mean-based sample size, accept another proportion or reverse-engineer a published interval. Those calculations are shown separately with their required assumptions.

Open Sample Size Calculator

Sources and method

NIST: selecting sample sizes

NIST: interpretation and construction of confidence intervals