Code
library("serocalculator")
library(dplyr)
antibodies <- c("HlyE_IgA", "HlyE_IgG")
curve <-
typhoid_curves_nostrat_100 |>
filter(antigen_iso %in% antibodies)
# Examples must not write into the user's working directory, so send the
# cache to a temporary one.
cache_dir <- file.path(tempdir(), "serocalculator-example-cache")
ests <- est_seroincidence_by_cached(
pop_data = sees_pop_data_pk_100,
sr_params = curve,
noise_params = example_noise_params_pk,
strata = "catchment",
antigen_isos = antibodies,
build_graph = FALSE,
num_cores = 1,
iterlim = 5, # limit iterations for the purpose of this example
cache_path = cache_dir
)
summary(ests)Seroincidence estimated given the following setup:
a) Antigen isotypes : HlyE_IgA, HlyE_IgG
b) Strata : catchment
Seroincidence estimates:
# A tibble: 2 × 14
Stratum catchment n est.start incidence.rate SE CI.lwr CI.upr se_type
<chr> <chr> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <chr>
1 Stratum… aku 53 0.1 0.140 0.0216 0.104 0.189 standa…
2 Stratum… kgh 47 0.1 0.200 0.0301 0.149 0.268 standa…
# ℹ 5 more variables: coverage <dbl>, log.lik <dbl>, iterations <int>,
# antigen.isos <chr>, nlm.convergence.code <ord>