Description Usage Arguments Details Value
sim_bites
simulates spatially-explicit transmission events per
infectious individual.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | sim_bites(
secondaries,
ids = I_now$id,
x_coords = I_now$x_coord,
y_coords = I_now$y_coord,
t_infectious = I_now$t_infectious,
counter = max(I_dt$id),
sim_movement = sim_movement_continuous,
dispersal_fun,
res_m,
row_ids,
cell_ids,
cells_block,
cells_out_bounds,
nrows,
ncols,
ncells,
x_topl,
y_topl,
weights = NULL,
admin_ids = NULL,
sequential = TRUE,
allow_invalid = TRUE,
leave_bounds = TRUE,
max_tries = 100,
params
)
|
secondaries |
numeric vector of number of secondary cases for each infectious individual |
ids |
numeric vector of the ids of infected individuals (progenitor ids) |
x_coords |
numeric vector, x coordinate (Easting) of infected individuals |
y_coords |
numeric vector, y coordinate (Northing) of infected individuals |
t_infectious |
numeric vector, the time (fractional time step) at which each individual became infectious |
counter |
integer, the id number to start with for resulting secondary cases |
sim_movement |
the movement function you want to use for simulating movement, options are sim_movement_continuous and sim_movement_prob (pass this through |
dispersal_fun |
function with a single parameter, n, which will draw distances for each individual to move in meters |
res_m |
numeric, the grid cell resolution in meters |
row_ids |
integer vector, the row ids corresponding to each grid cell in which the infectious individual is starting from |
cell_ids |
integer vector, the cell ids corresponding to each grid cell in which the infectious individual is starting from |
cells_block |
integer vector, the cell ids of grid cells where movements are invalid to, for use with max_tries @param cells_out_bounds integer vector, the cell ids of grid cells which are outside the bounds/ not covered by the area being simulated |
nrows |
numeric, the number of rows in the grid |
ncols |
numeric, the number of columns in the grid |
ncells |
numeric, the number of total cells (ncol * nrow) |
x_topl |
numeric, the top left x coordinate of the grid on which movement is being simulated |
y_topl |
numeric, the top left y coordinate of the grid on which movement is being simulated |
weights |
numeric vector, weights to give each grid cell for sampling moves
for use with sim_movement_prob; will be length ncells + 1,
see |
admin_ids |
if aggregating by the administrative unit (rather than grid cell), pass the rasterized administrative ids for each cell |
sequential |
boolean, if TRUE then movements are sequential, if FALSE, then movements are kernel based |
allow_invalid |
boolean, are movements to empty patches (i.e. with no dogs or bodies of water, etc.) valid |
leave_bounds |
boolean, are movements to outside of the boundaries of the are being simulated are valid |
max_tries |
integer, the maximum number of tries to make before accepting an invalid movement (i.e. transmission event fails due to either leaving the bounds of the simulation or moving to an uninhabitable grid cell) if either or both leave_bounds and allow_invalid are FALSE. |
This function takes the currently infectious individuals and the draws of the number of
secondary cases that they seed and simulates their movement.
Movements can be sequential (i.e. infected individuals moves from origin to
first location of exposure, then from this to the second, etc.)
or can be kernel based where movements are all seeded from
the origin location of the infected individual. Movements outside of the bounds
of the simulation or to uninhabitable grid cells can either be accepted (if
leave_bounds
or allow_invalid
are TRUE
). If FALSE
, these movements will not be
accepted and will be redrawn max_tries
times.
To Do:
Tests: returns should have same column structure & order as the I_dt template and rows should = sum of secondaries
rewrite in Rcpp? Will it actually speed this up? Maybe by reducing cost of function calls
a data.table that corresponds to the columns in I_dt in the simulation.
See simrabid
for full description.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.