View source: R/simulate_data.R
simulate_infection_histories | R Documentation |
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
)
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 |
a list with a matrix of infection histories for each individual in ages and the true attack rate for each epoch
Other simulation_functions:
simulate_attack_rates()
,
simulate_data()
,
simulate_group()
,
simulate_individual_faster()
,
simulate_individual()
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.