The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
The SampleSizeDiagnostics package provides a function
for calculating the sample size needed for evaluating a diagnostic test
based on sensitivity, specificity, prevalence, and desired
precision.
In this vignette, we will demonstrate how to use the
SampleSizeDiagnostics function to calculate the necessary
sample size for different scenarios.
Let’s calculate the sample size needed for a diagnostic test with the following parameters:
Sensitivity: 0.9
Specificity: 0.85
Prevalence: 0.2
Desired half-width (margin of error) of the confidence interval: 0.1
(This creates a total CI width of 0.2: estimate ±0.1)
Confidence interval level: 0.95
You can also calculate the sample size with a different confidence interval level, for example, 0.9:
The function returns a data frame containing the calculated sample sizes and input parameters. Here is a breakdown of the output:
Precision: Desired half-width of the CI (margin of error). Total width = 2 × Precision
Sensitivity: Sensitivity of the diagnostic test
Specificity: Specificity of the diagnostic test
Prevalence: Prevalence of the disease
N1: Sample size for sensitivity
N2: Sample size for specificity
Total_Subjects: Total sample size needed (maximum of N1 and N2)
CI: Confidence interval level
IMPORTANT: The parameter w represents
the half-width or margin of error of
the confidence interval, NOT the total width. This follows Buderer
(1996).
If you set w = 0.1 with expected sensitivity = 0.9: -
Point estimate: 0.90 - Margin of error
(w): ±0.1 - 95% CI: [0.80, 1.00] -
Half-width: 0.1 - Total CI width:
0.20
❌ Wrong: “I want a CI spanning 0.10 total, so I’ll
use w = 0.1”
✅ Correct: “I want a CI spanning 0.10 total, so I’ll
use w = 0.05”
From Buderer (1996), page 896: > “The width of a 95% CI, where the width is given by 1.96 × (SE), gives the precision > in the estimates… (the total length of the CI is 2 × width).”
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.