R/immunity_models.R
immunity_model_vacc_ifxn_biomarker_prot.Rd
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.
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
a vector of exposure IDs (x)
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
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
A probability of successful exposure is returned
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