| PopulationModel | R Documentation |
R6 class representing a spatially-explicit
demographic-based population model. It extends the SimulationModel
class with parameters for the population_simulator function. It
inherits functionality for creating a nested model, whereby a nested template model
with fixed parameters is maintained when a model is cloned for various sampled
parameters. Also provided are extensions to the methods for checking the consistency
and completeness of model parameters.
poems::GenericClass -> poems::GenericModel -> poems::SpatialModel -> poems::SimulationModel -> PopulationModel
attachedA list of dynamically attached attributes (name-value pairs).
simulation_functionName (character string) or source path of the default simulation function, which takes a model as an input and returns the simulation results.
model_attributesA vector of model attribute names.
regionA Region (or inherited class) object specifying the study region.
coordinatesData frame (or matrix) of X-Y population (WGS84) coordinates in longitude (degrees West) and latitude (degrees North) (get and set), or distance-based coordinates dynamically returned by region raster (get only).
random_seedNumber to seed the random number generation for stochasticity.
replicatesNumber of replicate simulation runs.
time_stepsNumber of simulation time steps.
years_per_stepNumber of years per time step.
populationsNumber of population cells.
stagesNumber of life cycle stages.
initial_abundanceArray (matrix) or raster (stack) of initial abundance values at each population cell (for each age/stage).
stage_matrixMatrix of transition (fecundity & survival) rates between stages at each time step (Leslie/Lefkovitch matrix).
fecundity_maskMatrix of 0-1 to indicate which (proportions) of transition rates refer to fecundity.
fecundity_maxMaximum transition fecundity rate (in Leslie/Lefkovitch matrix).
demographic_stochasticityBoolean for choosing demographic stochasticity for transition, dispersal, harvest and/or other processes.
standard_deviationStandard deviation matrix (or single value) for applying environmental stochasticity to transition rates.
correlationSimulator-dependent attribute or list of attributes for describing/parameterizing the correlation strategy utilized when applying environmental stochasticity and/or other processes (see population_simulator).
carrying_capacityArray (matrix), or raster (stack) of carrying capacity values at each population cell (across time).
density_dependenceSimulator-dependent function, attribute or list of attributes for describing/parameterizing the density dependence strategy utilized (see population_simulator).
growth_rate_maxMaximum growth rate (utilized by density dependence processes).
density_affectsTransition vital rates that are affected by density, including "fecundity", "survival", or a matrix of booleans or numeric (0-1) indicating vital rates affected (default is all).
density_stagesArray of booleans or numeric (0-1) for each stage to indicate (the degree to) which stages are affected by density (default is 1 for all stages).
translocationSimulator-dependent function, attribute or list of attributes for describing/parameterizing translocation (management) strategies utilized (see population_simulator).
harvestSimulator-dependent function, attribute or list of attributes for describing/parameterizing a harvest (organism removal/hunting) strategy (see population_simulator).
mortalitySimulator-dependent function, attribute or list of attributes to describe/parameterize a spatio-temporal mortality strategy (see population_simulator).
dispersalSimulator-dependent function, attribute or list of attributes for describing/parameterizing the dispersal (migration) strategy utilized (see population_simulator).
dispersal_stagesArray of relative dispersal (0-1) for each stage to indicate the degree to which each stage participates in dispersal (default is 1 for all stages).
dispersal_source_n_kSimulator-dependent attribute for describing/parameterizing dispersal dependent on source population abundance divided by carrying capacity (see population_simulator).
dispersal_target_kSimulator-dependent attribute for describing/parameterizing dispersal dependent on target population carrying capacity (see population_simulator).
dispersal_target_nSimulator-dependent attribute (default is list with threshold and cutoff) of attributes for describing/parameterizing dispersal dependent on target population abundance (see population_simulator).
dispersal_target_n_kSimulator-dependent attribute (default is list with threshold and cutoff) of attributes for describing/parameterizing dispersal dependent on target population abundance/capacity (see population_simulator).
abundance_thresholdAbundance threshold (that needs to be exceeded) for each population to persist.
simulation_orderA vector of simulation process names in configured order of execution (default is "transition", "translocation", "harvest", "mortality", "dispersal", "results").
results_selectionList of attributes to be included in the returned results of each simulation run, selected from: "abundance", "ema", "extirpation", "extinction_location", "harvested", "occupancy"; "summarize" or "replicate".
result_stagesArray of booleans or numeric (0, 1, 2, ...) for each stage to indicate which stages are included/combined (each unique digit > 0; optionally named) in the results (default is 1 for all stages).
attribute_aliasesA list of alternative alias names for model attributes (form: alias = "attribute") to be used with the set and get attributes methods.
template_modelNested template model for fixed (non-sampled) attributes for shallow cloning.
sample_attributesVector of sample attribute names (only).
required_attributesVector of required attribute names (only), i.e. those needed to run a simulation.
error_messagesA vector of error messages encountered when setting model attributes.
warning_messagesA vector of warning messages encountered when setting model attributes.
poems::GenericModel$get_attribute()poems::GenericModel$get_attribute_aliases()poems::SimulationModel$get_attribute_names()poems::SimulationModel$get_attributes()poems::SimulationModel$incomplete_attributes()poems::SimulationModel$inconsistent_attributes()poems::SimulationModel$is_complete()poems::SimulationModel$is_consistent()poems::SimulationModel$list_completeness()poems::SimulationModel$new_clone()poems::SimulationModel$set_attributes()poems::SimulationModel$set_sample_attributes()new()Initialization method sets default aliases and given attributes individually and/or from a list.
PopulationModel$new(attribute_aliases = NULL, ...)
attribute_aliasesA list of alternative alias names for model attributes (form: alias = "attribute") to be used with the set and get attributes methods.
...Parameters passed via a params list or individually.
list_consistency()Returns a boolean to indicate if (optionally selected or all) model attributes (such as dimensions) are consistent.
PopulationModel$list_consistency(params = NULL)
paramsOptional array of parameter/attribute names.
List of booleans (or NAs) to indicate consistency of selected/all attributes.
clone()The objects of this class are cloneable with this method.
PopulationModel$clone(deep = FALSE)
deepWhether to make a deep clone.
# 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 = NA, # set later
function(params) round(params$stage_abundance * (1 - params$rate))
)
harvest_rate_alias <- list(harvest_rate = "harvest$rate")
# Template model
stage_matrix <- matrix(c(
0, 2.5, # Leslie/Lefkovitch matrix
0.8, 0.5
), nrow = 2, ncol = 2, byrow = TRUE)
template_model <- PopulationModel$new(
region = region,
time_steps = 10, # years
populations = region$region_cells, # 7
stage_matrix = stage_matrix,
harvest = harvest,
results_selection = c("abundance", "harvested"),
attribute_aliases = harvest_rate_alias
)
template_model$model_attributes
template_model$required_attributes
# Nested model
nested_model <- PopulationModel$new(template_model = template_model)
nested_model$incomplete_attributes()
nested_model$set_sample_attributes(
initial_abundance = rep(10, 7),
carrying_capacity = array(70:1, c(10, 7)),
harvest_rate = 0.3
)
nested_model$inconsistent_attributes()
nested_model$carrying_capacity <- array(70:1, c(7, 10))
nested_model$is_consistent()
nested_model$is_complete()
nested_model$harvest$rate
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.