View source: R/power-analysis.R
| sequencing_power | R Documentation |
Estimates the minimum number of sequences needed to detect a lineage at a given frequency with specified precision.
sequencing_power(target_precision = 0.05, current_freq = 0.02, ci_level = 0.95)
target_precision |
Desired half-width of the frequency confidence interval. Default 0.05 (plus/minus 5 percentage points). |
current_freq |
True or assumed frequency of the target lineage. Can be a vector for multiple scenarios. Default 0.02 (2%). |
ci_level |
Confidence level. Default 0.95. |
Uses the normal approximation to the binomial:
n = z^2 \cdot p(1-p) / E^2
where z is the critical value, p is frequency, E is precision.
A tibble with columns: current_freq,
target_precision, required_n, ci_level.
# How many sequences to estimate a 2% lineage within +/-5%?
sequencing_power()
# Multiple scenarios
sequencing_power(current_freq = c(0.01, 0.02, 0.05, 0.10))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.