R/immunity_models.R
immunity_model_ifxn_biomarker_prot.Rd
This immunity model should only be used for infection events. The probability of a successful exposure event is dependent on the individual’s biomarker quantity at the time of exposure. User specified biomarker_prot_midpoint
and biomarker_prot_width
within model_pars
is used to calculate biomarker-mediated protection.
integer for the individual ID
integer for the time period
integer for the exposure ID
a 3D array of immune histories for all individuals, time steps and exposure IDs
an 3D array of biomarker states (biomarker quantities) for all individuals, time steps and biomarker IDs
a tibble of demographic information for each individual in the simulation
a table specifying the relationship between exposure IDs and biomarker IDs
a tibble of parameters needed for the immunity model
a vector of the maximum number of successful exposure events possible for each exposure ID
an optional table which indicates cross-reactivity between exposure and biomarker quantities. Here users can specify whether other biomarker quantities are also protective against successful exposure. Defaults to NULL.
if no cross_reactivity_table
is provided, this flag determines if protection is calculated as the sum of all cross-reactive biomarkers from the biomarker_map
, otherwise only uses biomarker for biomarker_id==exposure_id
Additional arguments
A probability of successful exposure is returned
tmp_immune_history <- array(0, dim=c(1, 10, 1))
## Toy example: individual has 1 prior exposure
tmp_immune_history[1,1,1] <- 1
## Set all biomarker states to 3 for sake of example
tmp_biomarker_states <- array(0, dim=c(1,10,1))
tmp_biomarker_states[1,,1] <- 3
tmp_pars <- reformat_biomarker_map(example_model_pars_biphasic)
## Probability of successful exposure (i.e., infection) depends on the biomarker quantity
immunity_model_ifxn_biomarker_prot(1,8,1,immune_histories=tmp_immune_history,
biomarker_states=tmp_biomarker_states, demography=NULL,
biomarker_map=example_biomarker_map_numeric, model_pars=tmp_pars, max_events=c(3,5))
#> [1] 0.4273919