View source: R/proposal_infection_history.R
inf_hist_swap_phi | R Documentation |
Swaps the entire contents of two columns of the infection history matrix, adhering to age and strain limitations. Also swaps the values of phi that correspond to these years
inf_hist_swap_phi(
infection_history,
phis,
age_mask,
strain_mask,
swap_propn,
move_size,
n_alive
)
infection_history |
matrix of 1s and 0s to swap around representing the infection history |
phis |
vector of force of infection parameters for each column |
age_mask |
the first index in infection_history that each individual (row) could be infected in |
strain_mask |
the last index in infection_history that each individual (row) could be infected in ie. the time of the latest blood sample |
swap_propn |
what proportion of infections should be swapped? |
move_size |
How many time points away should be chosen as candidate swaps? |
n_alive |
number of individuals alive in each entry of phis |
a list: the same infection_history matrix, but with two columns swapped; also the swapped phis
inf_hist_swap
Other proposals:
inf_hist_swap()
,
infection_history_symmetric()
,
mvr_proposal()
,
univ_proposal()
data(example_inf_hist)
data(example_titre_dat)
data(example_antigenic_map)
times <- example_antigenic_map$inf_times
ages <- unique(example_titre_dat[,c("DOB","individual")])
age_mask <- create_age_mask(ages$DOB, times)
strain_mask <- create_strain_mask(example_titre_dat, times)
phis <- runif(length(times))
n_alive <- get_n_alive(example_titre_dat,times)
new_inf_hist <- inf_hist_swap_phi(example_inf_hist, phis, age_mask,strain_mask, 1,3, n_alive)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.