View source: R/population_simulator.R
population_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:
Density dependence calculations (ceiling, logistic, or user-defined)
Environmental stochasticity calculations
Stage transition (stochastic) calculations
Translocation calculations (user-defined)
Harvest calculations (user-defined)
Mortality calculations (user-defined)
Dispersal calculations (default or user-defined)
Results collection
population_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 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 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.
harvested
Matrix or 3D array of individuals harvested: populations rows by time_steps columns (by replicates deep).
harvested_stages
List of matrices or 3D arrays of individuals harvested for unique stage combinations when present: each populations rows by time_steps columns (by replicates deep).
all$harvested
Array or matrix of individuals harvested across populations: time_steps (rows by replicates columns).
all$harvested_stages
List of arrays or matrices of individuals harvested across populations for unique stage combinations when present: each time_steps (rows by replicates columns).
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
).
# U Island example region
coordinates <- data.frame(
x = rep(seq(177.01, 177.05, 0.01), 5),
y = rep(seq(-18.01, -18.05, -0.01), each = 5)
)
template_raster <- Region$new(coordinates = coordinates)$region_raster # full extent
template_raster[][-c(7, 9, 12, 14, 17:19)] <- NA # make U Island
region <- Region$new(template_raster = template_raster)
# Harvest function
harvest <- list(
rate = 0.3,
function(params) round(params$stage_abundance * (1 - params$rate))
)
# Population model
stage_matrix <- matrix(c(
0, 2.5, # Leslie/Lefkovitch matrix
0.8, 0.5
), nrow = 2, ncol = 2, byrow = TRUE)
pop_model <- PopulationModel$new(
region = region,
time_steps = 10, # years
populations = region$region_cells, # 7
stage_matrix = stage_matrix,
initial_abundance = rep(10, 7),
carrying_capacity = array(70:1, c(7, 10)),
harvest = harvest,
results_selection = c("abundance", "harvested")
)
# Simulations
population_simulator(pop_model) # model
inputs <- pop_model$get_attributes()
population_simulator(inputs) # list
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.