Description Usage Arguments Details Value Examples
This function allows you to simulate a stochastic SIR epidemic, with a heterogeneous contact matrix.
1 |
N |
The size of the population. |
beta.mat |
An NxN matrix of the pair wise infection rates between all individuals. |
gamma |
The removal rate. |
The infectious life history of each individual is comprised of two parts;
Q_i, the length of individuals i's infectious period.
W_{i,j}, the length of time, after individual i becomes infected, before they make contact with individual j.
The distributions of which are given by;
Q_i ~ Exp(gamma).
W_{i,j} ~ Exp(beta_{i,j}).
The simulation begins with an initial infective infectious at time 0.
I_i is the time at which individual i becomes infected, and their removal time is given by R_i = I_i + Q_i.
If W_{i,j} < Q_i, then individual i makes infectious contact with individual j at time I_i + W_{i,j}.
If individual j is susceptible when this happens, then they become infected, otherwise nothing happens. The simulation assumes that W_{i,j} != W_{j,i}.
The simulation continues until there are no infected individuals left in the population.
The function returns a matrix containing 4 columns; the id number of each individual, their infection time (NA if not infected), their removal time (NA if not infected), and their generated infectious period length.
1 2 3 4 5 6 7 8 | # Generate a distance matrix
distance_mat <- Dist_mat_unif(N=100, xlim = 20, ylim = 20)[[2]]
# Generate an associated infection rate rate matrix
rate_mat <- Beta_mat_form(distance_mat, c(0.004, 0.002), 10)
# Generate a simulated epidemic
Hetero_sim <- GSE_sim(N = 100, beta.mat = rate_mat, gamma = 0.15)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.