Estimates the minimum number of sequences needed to detect a lineage at a given frequency with specified precision.
Details
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.
Examples
# How many sequences to estimate a 2% lineage within +/-5%?
sequencing_power()
#> # A tibble: 1 × 4
#> current_freq target_precision required_n ci_level
#> <dbl> <dbl> <dbl> <dbl>
#> 1 0.02 0.05 31 0.95
# Multiple scenarios
sequencing_power(current_freq = c(0.01, 0.02, 0.05, 0.10))
#> # A tibble: 4 × 4
#> current_freq target_precision required_n ci_level
#> <dbl> <dbl> <dbl> <dbl>
#> 1 0.01 0.05 16 0.95
#> 2 0.02 0.05 31 0.95
#> 3 0.05 0.05 73 0.95
#> 4 0.1 0.05 139 0.95