View source: R/est.incidence.by.R
| est.incidence.by | R Documentation |
Function to estimate seroincidences based on cross-sectional serology data and longitudinal response model.
est.incidence.by(
pop_data,
curve_params,
noise_params,
strata,
curve_strata_varnames = strata,
noise_strata_varnames = strata,
antigen_isos = pop_data %>% pull("antigen_iso") %>% unique(),
lambda_start = 0.1,
build_graph = FALSE,
num_cores = 1L,
verbose = FALSE,
print_graph = FALSE,
...
)
pop_data |
a data.frame with cross-sectional serology data per
antibody and age, and additional columns corresponding to
each element of the |
curve_params |
a
|
noise_params |
a
|
strata |
a character vector of stratum-defining variables.
Values must be variable names in |
curve_strata_varnames |
A subset of |
noise_strata_varnames |
A subset of |
antigen_isos |
Character vector with one or more antibody names. Values must match |
lambda_start |
starting guess for incidence rate, in years/event. |
build_graph |
whether to graph the log-likelihood function across a range of incidence rates (lambda values) |
num_cores |
Number of processor cores to use for calculations when computing by strata. If set to more than 1 and package parallel is available, then the computations are executed in parallel. Default = 1L. |
verbose |
logical: if TRUE, print verbose log information to console |
print_graph |
whether to display the log-likelihood curve graph in the course of running |
... |
Arguments passed on to
|
If strata is left empty, a warning will be produced,
recommending that you use est.incidence() for unstratified analyses,
and then the data will be passed to est.incidence().
If for some reason you want to use est.incidence.by()
with no strata instead of calling est.incidence(),
you may use NA, NULL, or "" as the strata
argument to avoid that warning.
if strata has meaningful inputs:
An object of class "seroincidence.by"; i.e., a list of
"seroincidence" objects from est.incidence(), one for each stratum,
with some meta-data attributes.
if strata is missing, NULL, NA, or "":
An object of class "seroincidence".
library(dplyr)
xs_data <-
sees_pop_data_pk_100
curve <-
typhoid_curves_nostrat_100 %>%
filter(antigen_iso %in% c("HlyE_IgA", "HlyE_IgG"))
noise <-
example_noise_params_pk
est2 <- est.incidence.by(
strata = c("catchment"),
pop_data = xs_data,
curve_params = curve,
noise_params = noise,
antigen_isos = c("HlyE_IgG", "HlyE_IgA"),
# num_cores = 8 # Allow for parallel processing to decrease run time
iterlim = 5 # limit iterations for the purpose of this example
)
summary(est2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.