PaleoPopResults | R Documentation |
R6
class for encapsulating and dynamically generating
spatially-explicit paleopop_simulator
results, as well as optional
re-generated Generator
for niche carrying capacity and/or human
density.
poems::GenericClass
-> poems::GenericModel
-> poems::SpatialModel
-> poems::SimulationResults
-> PaleoPopResults
attached
A list of dynamically attached attributes (name-value pairs).
model_attributes
A vector of model attribute names.
region
A Region
(or inherited class) object specifying the study region.
coordinates
Data frame (or matrix) of X-Y population coordinates (WGS84) in longitude (degrees West) and latitude (degrees North).
time_steps
Number of simulation time steps.
burn_in_steps
Optional number of initial 'burn-in' time steps to be ignored.
occupancy_mask
Optional binary mask array (matrix), data frame, or raster (stack) for each cell at each time-step of the simulation including burn-in.
trend_interval
Optional time-step range (indices) for trend calculations (assumes indices begin after the burn-in when utilized).
abundance
Matrix of population abundance across simulation time-steps (populations rows by duration columns).
abundance_trend
Trend or average Sen's slope
of total abundance (optionally across a time-step interval).
ema
Matrix of population expected minimum abundance (EMA) across simulation time-steps (populations rows by duration columns).
extirpation
Array of population extirpation times.
extinction_location
The weighted centroid of cells occupied in the time-step prior to the extirpation of all populations (if occurred).
harvested
Matrix of the number of animals harvested from each population at each time-step (populations rows by duration columns).
occupancy
Array of the number of populations occupied at each time-step.
carrying_capacity
Optional matrix of simulation input carrying capacity to be combined with results (populations rows by duration columns).
human_density
Optional matrix of simulation input human density to be combined with results (populations rows by duration columns).
all
Nested simulation results for all cells.
parent
Parent simulation results for individual cells.
default
Default value/attribute utilized when applying primitive metric functions (e.g. max) to the results.
attribute_aliases
A list of alternative alias names for model attributes (form: alias = "attribute"
) to be used with the set and get attributes methods.
error_messages
A vector of error messages encountered when setting model attributes.
warning_messages
A vector of warning messages encountered when setting model attributes.
clone()
The objects of this class are cloneable with this method.
PaleoPopResults$clone(deep = FALSE)
deep
Whether to make a deep clone.
library(raster)
library(poems)
# Ring Island example region
coordinates <- data.frame(x = rep(seq(-178.02, -178.06, -0.01), 5),
y = rep(seq(19.02, 19.06, 0.01), each = 5))
template_raster <- Region$new(coordinates = coordinates)$region_raster # full extent
sealevel_raster <- template_raster
template_raster[][c(7:9, 12:14, 17:19)] <- NA # make Ring Island
sealevel_raster[][c(7:9, 12:14, 17:18)] <- NA
raster_stack <- raster::stack(x = append(replicate(9, template_raster), sealevel_raster))
region <- PaleoRegion$new(template_raster = raster_stack)
# Model template
model_template <- PaleoPopModel$new(
region = region,
time_steps = 10,
years_per_step = 12, # years per generational time-step
standard_deviation = 0.1,
growth_rate_max = 0.6,
harvest = FALSE,
populations = region$region_cells,
initial_abundance = seq(9000, 0, -1000),
transition_rate = 1.0,
carrying_capacity = rep(1000, 17),
dispersal = (!diag(nrow = 17, ncol = 17))*0.05,
density_dependence = "logistic",
dispersal_target_k = 10,
occupancy_threshold = 1,
abundance_threshold = 10,
results_selection = c("abundance")
)
# Simulations
results <- paleopop_simulator(model_template)
# Results
results_model <- PaleoPopResults$new(results = results, region = region, time_steps = 10)
results_model$extirpation # cells where the population goes to zero are marked 1
results_model$occupancy # indicates with 0 and 1 which cells are occupied at each time step
results_model$ema # expected minimum abundance
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.