Statistical Calculators › Diagnostic Accuracy and Agreement › Sensitivity and Specificity Sample Size Calculator
← All Calculators

Diagnostic Accuracy and Agreement

Sensitivity and Specificity Sample Size Calculator

Estimates the total sample size needed to obtain two-sided confidence intervals for both diagnostic sensitivity and specificity with a specified precision. The calculation accounts for disease prevalence, so the required numbers of disease-positive and disease-negative participants are translated into a whole-study sample size.

Study Assumptions

Enter the anticipated diagnostic accuracy and the precision required for the confidence intervals.
A width of 0.14 corresponds to a margin of error of ±0.07. The calculation uses the simple asymptotic (normal-approximation) confidence interval.

Required Sample Size

The final sample size is the larger of the numbers required for sensitivity and specificity after accounting for prevalence.
Enter the study assumptions and click Calculate Sample Size.

Methodology

Sensitivity is the proportion of participants with the target condition who test positive, while specificity is the proportion of participants without the condition who test negative. For a diagnostic accuracy study, the two precision requirements depend on different subsets of the enrolled population.

Simple Asymptotic Confidence Interval

This calculator uses the simple asymptotic, or Wald, approximation for a two-sided confidence interval. For an anticipated proportion p based on n participants, the approximate interval is:

p̂ ± z1−α/2 √[p̂(1−p̂) / n]

Target width: W = U − L
Margin of error: d = W / 2

n = z1−α/22 p(1−p) / d2

The calculation first determines how many disease-positive participants are needed to estimate sensitivity and how many disease-negative participants are needed to estimate specificity. Prevalence then converts those two quantities into total study sample sizes:

NSens = ceil(npositive / prevalence)
NSpec = ceil(nnegative / (1 − prevalence))

N = max(NSens, NSpec)

This follows the relevant methodological literature's description of the one-sample sensitivity/specificity confidence-interval procedure: the sensitivity calculation first determines the required number of condition-positive individuals, while the specificity calculation determines the required number of condition-negative individuals; prevalence is then used to obtain the corresponding whole-table sample sizes, with the larger requirement determining the final sample size.

Worked Validation Example

this method provides a validation example based on Hajian-Tilaki (2014): 95% confidence, anticipated sensitivity of 0.80, specificity of 0.80, disease prevalence of 0.10, and a two-sided confidence-interval width of 0.14 (equivalent to ±0.07 precision). This yields 1260 total subjects, with 126 disease-positive subjects required for sensitivity and 126 disease-negative subjects required for specificity before prevalence adjustment. After accounting for the 10% prevalence, sensitivity requires 1260 total subjects, while specificity requires 140; therefore the final sample size is 1260.

Sensitivity: npositive = 126 → 126 / 0.10 = 1260
Specificity: nnegative = 126 → 126 / 0.90 = 140
Final N = max(1260, 140) = 1260

The calculator reproduces this this method validation result. The optional dropout adjustment is applied after the evaluable sample size is determined:

Nenroll = ceil[N / (1 − dropout rate)]

Important Interpretation

The anticipated sensitivity and specificity are planning assumptions. If the actual sensitivity or specificity differs from the assumed value, the achieved confidence-interval width may differ from the target. The normal approximation is most appropriate when the relevant condition-positive and condition-negative sample sizes are sufficiently large; exact or score-based intervals may be preferable for small samples or proportions near 0 or 1.

References

Buderer, N. M. (1996). Statistical methodology: I. Incorporating the prevalence of disease into the sample size calculation for sensitivity and specificity. Academic Emergency Medicine, 3(9), 895–900. DOI: 10.1111/j.1553-2712.1996.tb03538.x.

Hajian-Tilaki, K. (2014). Sample size estimation in diagnostic test studies of biomedical informatics. Journal of Biomedical Informatics, 48, 193–204. DOI: 10.1016/j.jbi.2014.02.013.

the software, LLC. this method Sample Size Software: Confidence Intervals for One-Sample Sensitivity and Specificity, Chapter 273.