Description Usage Arguments Value Author(s) Examples
View source: R/simulate_poisson.R
For a given reproduction number, this function simulate the incidence of a disease at each generation. The offspring distribution of each individual infected is assumed to follow a Poisson distribution with mean equal to the reproduction number. To simulate under-reporting, users can specify a probability to observe case, this reporting probability is assumed constant through the simulation.
1 | simulate_poisson(R, n, s, rho, t_max)
|
R |
is the reproduction number, i.e. the average number of secondary cases due to a single case. This can be any positive number. if R is a vector, then the length of R must be 'n' (see below). |
n |
is the number of simulations performed. Each simulation start with 's' individual(s) infected. 'n' must be a positive integer. |
s |
is the number individual(s) initially infected. if s is a vector, then the length of s must be 'n' (see above). |
rho |
is the probability (between 0 and 1) that an incident case is observed, i.e. reporting probability. if rho is a vector, then the length of rho must be 'n' (see below) |
t_max |
is the maximum number of generations simulated. 't_max' must be a positive integer. |
The function returns a list including:
true_incidence: the true incidence over time.
reported_incidence: the observed incidence over time accounting for under-reporting (rho).
observed_incidence: same as reported_incidence, but only including simulated outbreaks for which at least a single case was observed (i.e. outbreak for which the observed final size is 0, see below reported_size, are removed).
true_size: the final outbreak sizes for each simulated outbreaks. Note that for outbreaks that are not extinct 'final' by the end of the simulation, z_sim correspond to the cumulative incidence by time t_max.
reported_size: the observed final outbreak sizes accounting for under-reporting (rho).
observed_size: same as reported_size, but only including simulated outbreaks for which at least a single case was observed.
Note that if some simulated outbreaks are not extinct by the end of the simulation, a warning is displayed.
Pierre Nouvellet (p.nouvellet@imperial.ac.uk)
1 2 | x <- simulate_poisson(.9, 5, 1, .5, 1e2)
x
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.