Nothing
## ----setup, include = FALSE---------------------------------------------------
knitr::opts_chunk$set(
collapse = TRUE, comment = "#>",
fig.width = 7, fig.height = 4, dev = "png"
)
## ----quickstart---------------------------------------------------------------
library(survinger)
# Load example data (simulated, 5 regions, 26 weeks)
data(sarscov2_surveillance)
sim <- sarscov2_surveillance
# Create a surveillance design object
design <- surv_design(
data = sim$sequences,
strata = ~ region,
sequencing_rate = sim$population[c("region", "seq_rate")],
population = sim$population,
source_type = "source_type"
)
print(design)
## ----comparison, fig.cap = "Weighted vs naive prevalence estimates for BA.2.86"----
weighted <- surv_lineage_prevalence(design, "BA.2.86", method = "hajek")
naive <- surv_naive_prevalence(design, "BA.2.86")
surv_compare_estimates(weighted, naive)
## ----allocation---------------------------------------------------------------
alloc <- surv_optimize_allocation(design, "min_mse", total_capacity = 500)
print(alloc)
## ----compare-alloc------------------------------------------------------------
surv_compare_allocations(design, total_capacity = 500)
## ----delay--------------------------------------------------------------------
delay_fit <- surv_estimate_delay(design)
print(delay_fit)
nowcast <- surv_nowcast_lineage(design, delay_fit, "BA.2.86")
plot(nowcast)
## ----adjusted-----------------------------------------------------------------
adjusted <- surv_adjusted_prevalence(design, delay_fit, "BA.2.86")
print(adjusted)
## ----detection----------------------------------------------------------------
det <- surv_detection_probability(design, true_prevalence = 0.01)
cat("Weekly detection probability:", round(det$overall, 3), "\n")
cat("Required sequences for 95% detection:", surv_required_sequences(0.01), "\n")
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.