Given a vector of infection probabilities and potential infection times, simulates infections for each element of ages (ie. each element is an individual age. Only adds infections for alive individuals)

simulate_infection_histories(
  p_inf,
  strain_isolation_times,
  sampling_times,
  DOBs
)

Arguments

p_inf

a vector of attack rates (infection probabilities) for each year

strain_isolation_times

the vector of possible infection times

sampling_times

vector of potential sampling times

DOBs

a vector of ages for each individual

Value

a list with a matrix of infection histories for each individual in ages and the true attack rate for each epoch

See also

Examples

p_inf <- runif(40,0.1,0.4) strain_isolation_times <- seq_len(40) + 1967 n_indivs <- 100 sampling_times <- rep(max(strain_isolation_times), n_indivs) DOBs <- rep(min(strain_isolation_times), n_indivs) inf_hist <- simulate_infection_histories(p_inf, strain_isolation_times, sampling_times, DOBs)