Skip to main content

    Method document

    Sample size to show that diagnostic accuracy exceeds a minimum

    How many people must be tested to show, with exact one-sided tests, that a diagnostic test’s sensitivity, specificity, or both exceed prespecified minimum acceptable values, from their expected values and the prevalence in a consecutive sample. Covers dropout.

    Engine version 1.0.0 · Reviewed 6 October 2026

    https://statwisely.com/methods/proportions-diagnostic-test/

    When to use it

    • Validating a new test against a reference standard when its accuracy must clear a threshold, such as sensitivity above 75%, for it to be useful.

    Not for

    • Estimating accuracy with a stated precision. Use the sensitivity and specificity planner.
    • Comparing two tests on the same people, which needs a paired design.

    Notation

    Se, SpSe,\ Sp
    Expected sensitivity and specificity
    Se0, Sp0Se_0,\ Sp_0
    Minimum acceptable sensitivity and specificity
    n+, n−n_+,\ n_-
    Reference-standard positives and negatives required
    PrevPrev
    Expected prevalence
    α\alpha
    Significance level: the chance of a false positive
    1−β1-\beta
    Power: the chance of detecting the effect if it is real
    qq
    Expected dropout

    Formulas

    Exact tests, then the number to screen

    N=max⁡ ⁣(⌈n+Prev⌉,⌈n−1−Prev⌉)N = \max\!\left(\left\lceil \frac{n_+}{Prev} \right\rceil, \left\lceil \frac{n_-}{1-Prev} \right\rceil\right)

    n₊ is the smallest number of reference-standard positives from which the exact one-sided binomial test of Se > Se₀ keeps the required power, and n₋ likewise for Sp > Sp₀ [1]. The two are measured on different people, so when both must succeed each is planned at power √(1 − β), which gives 1 − β jointly.

    Dropout

    nrecruit=⌈n1−q⌉n_{\text{recruit}} = \left\lceil \frac{n}{1 - q} \right\rceil

    Applied last, to the participants actually recruited.

    Parameters

    Expected sensitivitySeSeOptional

    Values: Above the minimum and below 1

    Omit, with its minimum, to test specificity only.

    Minimum acceptable sensitivitySe0Se_0Optional

    Values: Between 0 and 1

    The value the study must rule out, fixed before the data are seen.

    Expected specificitySpSpOptional

    Values: Above the minimum and below 1

    Omit, with its minimum, to test sensitivity only.

    Minimum acceptable specificitySp0Sp_0Optional

    Values: Between 0 and 1

    Fixed before the data are seen.

    Expected prevalencePrevPrev

    Values: Greater than 0 and less than 1

    In the people who will be tested consecutively.

    Significance levelα\alpha

    Values: Between 0 and 1; usually 0.05

    The false-positive rate you accept. A smaller α, for example to allow for several primary outcomes, needs a larger sample.

    Power1−β1-\beta

    Values: Between 0 and 1; usually 0.80 or 0.90

    The chance of a significant result if the assumed effect is real. Funders and ethics committees commonly expect at least 0.80.

    Expected dropoutqqOptional

    Values: 0% up to, but not including, 100%

    The share of participants expected to provide no outcome, from comparable studies. Recruiting more restores the numbers, not the comparability of the groups: if dropout is related to the outcome, the estimate can still be biased.

    Assumptions

    • Participants are independent, sampled consecutively at the stated prevalence, and the reference standard is accurate.
    • Exact power is not monotone in the sample size; the size reported is the one from which power stays above the target.
    • Dropout is unrelated to the outcome; recruiting more participants restores the numbers but cannot remove bias.

    Worked examples

    Both measures above their minimums

    Sensitivity 0.9 against 0.75 and specificity 0.95 against 0.85, prevalence 0.2, one-sided α = 0.05, 80% power jointly: 60 positives and 85 negatives, so N = 300.

    Sample size: 300

    Protocol statement

    To detect sensitivity of 90% against 75% and specificity of 95% against 85% with 80% power at a one-sided significance level of 0.05, using exact one-sided tests that sensitivity and specificity exceed their minimum values, and assuming a prevalence of 20%, the required sample size is 300 participants. Calculated with StatWisely (statwisely.com) using: N = max(n₊/Prev, n₋/(1-Prev)); n₊, n₋: exact binomial tests of Se and Sp against their minimums. These are planning estimates; confirm the final design with a qualified statistician.

    Open this example in the calculator

    A stricter sensitivity minimum

    Ruling out a sensitivity of 0.8 instead: N = 620.

    Sample size: 620

    Open this example in the calculator

    Allowing for unverified participants

    Expecting 10% without a reference-standard result: 334 are recruited.

    Needed for analysis: 300 · To recruit: 334

    Protocol statement

    To detect sensitivity of 90% against 75% and specificity of 95% against 85% with 80% power at a one-sided significance level of 0.05, using exact one-sided tests that sensitivity and specificity exceed their minimum values, and assuming a prevalence of 20%, the required sample size is 300 participants. Allowing for 10% dropout, 334 participants should be recruited. Calculated with StatWisely (statwisely.com) using: N = max(n₊/Prev, n₋/(1-Prev)); n₊, n₋: exact binomial tests of Se and Sp against their minimums. These are planning estimates; confirm the final design with a qualified statistician.

    Open this example in the calculator

    Validation

    • Every worked example on this page is recomputed by the StatWisely engine whenever the software is built. If a number or formula here stopped matching the calculator, the release would be stopped until this document was corrected.
    • An independent implementation in R recomputes this test every night and before each production release, and the results are compared with the engine’s.
    • The exact binomial power, computed independently in R, is 0.927 for 60 positives and 0.938 for 85 negatives in the first example, so 0.869 jointly against a target of 0.80. An independent R search reproduces the engine’s sizes.

    How to cite

    StatWisely. Sample size to show that diagnostic accuracy exceeds a minimum. Method document, engine version 1.0.0, reviewed 2026-10-06. https://statwisely.com/methods/proportions-diagnostic-test/

    Cite the original references for the formulas your design uses as well.

    References

    1. 1.Flahault A, Cadilhac M, Thomas G. Sample size calculation should be performed for design accuracy in diagnostic test studies. Journal of Clinical Epidemiology. 2005;58(8):859–862. doi:10.1016/j.jclinepi.2004.12.009