View source: R/disease_simulator.R
disease_simulator | R Documentation |
Simulates a stage-based demographic population model and returns simulation results across multiple replicate runs. Processes run at each simulation time-step include:
Stage transition (stochastic) calculations
Population growth/decline calculations
Disease outbreak according to a compartmental model
Dispersal calculations (default or user-defined)
Results collection
Note that the breeding season is always treated as the first season.
disease_simulator(inputs)
inputs |
Nested list/object with named elements:
|
Selected simulation results as a nested list summarized (mean, sd, min, max) across multiple replicates (default), or 2-3D arrays including results for each replicate:
abundance
Matrix or 3D array of simulation abundance: populations rows by time_steps columns (by replicates deep).
abundance_stages
List of matrices or 3D arrays of simulation abundance for unique stage-compartment combinations when present: each populations rows by time_steps columns (by replicates deep).
all$abundance
Array or matrix of total abundance across populations: time_steps (rows by replicates columns).
all$abundance_stages
List of arrays or matrices of total abundance across populations for unique stage-compartment combinations when present: each time_steps (rows by replicates columns).
all$ema
Array of expected minimum abundance at each time step (averaged across replicates).
extirpation
Array or matrix of extirpation times: populations (rows by replicates columns).
all$extirpation
Array of extirpation time across populations for each replicate.
all$extinction_location
The weighted centroid of cells occupied in the time-step prior to the extirpation of all populations (if it occurred) for each replicate.
all$occupancy
Array or matrix of the number of populations occupied at each time-step: time_steps (rows by replicates columns).
additional results
Additional results may be attached via
user-defined functions (using params$simulator$results
).
inputs <- list(
time_steps = 5,
seasons = 2,
populations = 25,
stages = 2,
compartments = 4,
coordinates = data.frame(x = rep(seq(177.01, 177.05, 0.01), 5),
y = rep(seq(-18.01, -18.05, -0.01), each = 5)),
initial_abundance = c(c(5000, 5000, 0, 1, 0, 0, 0, 0),
rep(c(5000, 5000, 0, 0, 0, 0, 0, 0), 24)) |>
matrix(nrow = 8),
carrying_capacity = matrix(100000, nrow = 25, ncol = 5),
breeding_season_length = rep(100, 25),
mortality = c(0.4, 0, 0.505, 0.105, 0.4, 0, 0.45, 0.05),
mortality_unit = 1,
fecundity = 15,
fecundity_unit = 1,
fecundity_mask = c(0, 1, 0, 1, 0, 1, 0, 1),
transmission = c(0.00002, 0.00001, 7.84e-06, 3.92e-06),
transmission_unit = 0,
transmission_mask = c(1, 1, 0, 0, 1, 1, 0, 0),
recovery = c(0.05714286, 0.05714286, 0.1, 0.1),
recovery_unit = rep(0, 8),
recovery_mask = c(0, 0, 1, 1, 0, 0, 1, 1),
season_functions = list(siri_model_summer, siri_model_winter),
simulation_order = c("transition", "season_functions", "results")
)
disease_simulator(inputs)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.