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.

immunity_model_ifxn_biomarker_prot(
  i,
  t,
  x,
  immune_histories,
  biomarker_states,
  demography,
  biomarker_map,
  model_pars,
  max_events = rep(Inf, dim(immune_histories)[3]),
  cross_reactivity_table = NULL,
  sum_biomarkers = FALSE,
  ...
)

Arguments

i

integer for the individual ID

t

integer for the time period

x

integer for the exposure ID

immune_histories

a 3D array of immune histories for all individuals, time steps and exposure IDs

biomarker_states

an 3D array of biomarker states (biomarker quantities) for all individuals, time steps and biomarker IDs

demography

a tibble of demographic information for each individual in the simulation

biomarker_map

a table specifying the relationship between exposure IDs and biomarker IDs

model_pars

a tibble of parameters needed for the immunity model

max_events

a vector of the maximum number of successful exposure events possible for each exposure ID

cross_reactivity_table

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.

sum_biomarkers

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

Value

A probability of successful exposure is returned

Examples

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