paleopop_simulator: Runs a customized population model simulation.

View source: R/paleopop_simulator.R

paleopop_simulatorR Documentation

Runs a customized population model simulation.

Description

Simulates a population model customized for paleontological time-scales, optimized for single-generation transitions and large populations, across multiple generations and returns simulation results. Each generational time-step includes:

  1. Density dependence calculations

  2. Environmental stochasticity calculations

  3. Generational transition calculations

  4. Harvest calculations

  5. Dispersal calculations

  6. Results collection

Usage

paleopop_simulator(inputs)

Arguments

inputs

Nested list/object with named elements:

random_seed

Number to seed the random number generation for stochasticity.

time_steps

Number of simulation time steps.

years_per_step

Number of years per time step.

populations

Number of populations.

initial_abundance

Array of initial abundances for each population.

transition_rate

Rate of transition (or fecundity) between generations.

standard_deviation

Standard deviation applied to transition rates.

compact_decomposition

List containing a compact transposed (Cholesky) decomposition matrix (t_decomposition_compact_matrix) and a corresponding map of population indices (t_decomposition_compact_map), as per SpatialCorrelation class attributes.

carrying_capacity

Matrix of carrying capacities (populations rows by time_steps columns).

density_dependence

Density dependence type ("competition", "logistic", or "ceiling").

growth_rate_max

Maximum growth rate (for "competition" or "logistic" density dependence).

harvest

Boolean for utilizing harvesting.

harvest_max

Proportion harvested per year (note: annual time scale - not generational).

harvest_g

The G parameter in the harvest function.

harvest_z

The Z parameter in the harvest function.

harvest_max_n

Maximum density per grid cell.

human_density

Matrix of human density (fraction) (populations rows by time_steps columns).

dispersal_data

List of data frames of non-zero dispersal rates and indices for constructing a compact dispersal matrix, and optional changing rates over time, as per class DispersalGenerator dispersal_data attribute.

dispersal_target_k

Target population carrying capacity threshold for density dependent dispersal.

abundance_threshold

Abundance threshold (that needs to be exceeded) for each population to persist.

occupancy_threshold

Threshold for the number of populations occupied (that needs to be exceeded) for all populations to persist.

results_selection

List of results selection from: "abundance", "ema", "extirpation", "harvested", "occupancy", "human_density".

Value

Simulation results as a nested list (as selected):

abundance

Matrix of simulation abundances (populations rows by time_steps columns).

ema

Matrix of expected minimum abundances (populations rows by time_steps columns).

extirpation

Array of extirpation times for each population.

harvested

Matrix of estimated individuals harvested (populations rows by time_steps columns).

occupancy

Array of number of populations occupied at each time-step.

human_density

Matrix of human densities, (populations rows by time_steps columns).

Examples

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) # input as PaleoPopModel object
inputs <- model_template$get_attributes()
paleopop_simulator(inputs) # input as list of attributes


paleopop documentation built on Oct. 11, 2023, 5:14 p.m.