*! version 1.0.0 02Aug2020

Title

diagsampsi -- Sample size for a single diagnostic test with a binary outcome

Syntax

Sample size for sensitivity:

diagsampsi sensitivity
sn
[,
prev(#)
width(#)
level(#)
]

Sample size for specificity:

diagsampsi specificity
sp
[,
prev(#)
width(#)
level(#)
]

In the syntax for diagsampsi sensitivity, sn refers to the expected sensitivity of the new diagnostic test
and in the syntax for diagsampsi specificity, sp refers to the expected specificity of the new diagnostic test

prev(#) specify the prevalence of disease in the target population (ranging from 0.01 to 1.0); default is prev(0.50)

width(#) specify the half width of the confidence interval (ranging from 0.01 to 1.0) that is maximally clinically acceptable; default is width(0.10)

level(#) set confidence level; default is level(95) or as set by set level

Description

diagsampsi performs sample size calculations for sensitivity and specificity of a single diagnostic test with a binary outcome, according to Buderer (1996). diagsampsi is an immediate command; see immed
for more on immediate commands.

The sample size computation depends on 3 quantities that the user must specify:
(1) the expected sensitivity (specificity) of the new diagnostic test,
(2) the prevalence of disease in the target population, and
(3) a clinically acceptable width of the a confidence interval for the estimates. Optionally, diagsampsi allows the user to choose the confidence level.

In many cases, the user will want to compute a sample size that accounts for a different level of sensitivity and specificity
(e.g. 80% and 60% for sensitivity and specificity, respectively). In this case, the larger of the two sample size estimates should be used to ensure the desired
precision is preserved.

Options

prev(#) specifies the prevalence of disease in the target population (ranging from 0.01 to 1.0); default is prev(0.50).
(Note that this is an entirely arbitrary level and a known or estimated level is always preferred). For sensitivity, a higher prevalence requires a smaller
sample size, whereas for specificity, a higher prevalence requires a higher sample size.

width(#) specifies the half width of the confidence interval (ranging from 0.01 to 1.0) that is maximally clinically acceptable; default is width(0.10).
The narrower the specified width the larger the sample size required, and vice versa.

level(#) specifies the confidence level, as a percentage, for confidence intervals. The default is level(95) or as set by
set level.

Examples

1) Sample size for sensitivity

Sensitivity example from Buderer (1996)

. diagsampsi sens 0.90, prev(0.20) width(0.10)

2) Sample size for specificity

Specificity example from Buderer (1996)

. diagsampsi spec 0.85, prev(0.20) width(0.10)

If the user is interested in identifying a sample size appropriate for both sensitivity and specificity,
then the larger of the two estimates should be used (in this case, the N for sensitivity = 173, and is larger than the N for
specificity = 62)

Stored results

diagsampsi stores the following in r():

Scalars

r(N) the estimated sample size

r(prev) the user specified prevalence

r(width) the user specified width of the confidence interval

r(level) the user specified confidence interval

r(sens) the user specified expected sensitivity

r(spec) the user specified expected specificity

References

Buderer, N. M. (1996). Statistical methodology: I. Incorporating the prevalence of disease into the sample size calculation for sensitivity and specificity.
Acad Emerg Med. 3: 895-900.

Citation of diagsampsi

diagsampsi is not an official Stata command. It is a free contribution
to the research community, like a paper. Please cite it as such:

Linden A (2020). DIAGSAMPSI: Stata module for computing sample size for a single diagnostic test with a binary outcome.

Author

Ariel Linden

President, Linden Consulting Group, LLC

alinden@lindenconsulting.org

Also see

Online: power oneproportion