This immunity model should be used if exposures represent vaccination and infection events. The probability of a successful vaccination exposure event depends on the number of vaccines received prior to time t while the probability of successful infection is dependent on the biomarker quantity at the time of exposure and the total number of successful infections prior to that point.

immunity_model_vacc_ifxn_biomarker_prot(
  i,
  t,
  x,
  immune_histories,
  biomarker_states,
  demography,
  biomarker_map,
  model_pars,
  max_events = rep(Inf, dim(immune_histories)[3]),
  vacc_exposures = rep(Inf, dim(immune_histories)[3]),
  vacc_age = 1,
  cross_reactivity_table = NULL,
  ...
)

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

vacc_exposures

a vector of exposure IDs (x)

vacc_age

a vector of the minimum age at which an individual is eligible for vaccination for each exposure event; If an exposure event is not a vaccination event then input NA

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.

...

Additional arguments

Value

A probability of successful exposure is returned

Examples

tmp_immune_history <- array(0, dim=c(1, 10, 2))
## Toy example: individual has 3 prior exposures to exposure ID 1, and none to exposure ID 2
tmp_immune_history[1,1:3,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_demography <- dplyr::tibble(i=1, birth=1)
tmp_pars <- reformat_biomarker_map(example_model_pars_biphasic)
## Successful exposure probability for exposure ID 1 (representing vaccination) 
## is 1 or 0 depending on exposure history
immunity_model_vacc_ifxn_biomarker_prot(1,8,1,immune_histories=tmp_immune_history, 
biomarker_states=tmp_biomarker_states, demography=tmp_demography, 
biomarker_map=example_biomarker_map_numeric, model_pars=tmp_pars,
max_events=c(3),vacc_exposures=c(1),vacc_age=c(1))
#> [1] 0

## Successful exposure probability for exposure ID 2 (representing infection) 
## is conditional on titer
immunity_model_vacc_ifxn_biomarker_prot(1,8,2,immune_histories=tmp_immune_history, 
biomarker_states=tmp_biomarker_states, demography=tmp_demography, 
biomarker_map=example_biomarker_map_numeric, model_pars=tmp_pars,max_events=c(3,10),
vacc_exposures=c(1),vacc_age=c(1))
#> [1] 0.9999039