Learn R Programming

epizootic (version 2.0.0)

disease_dispersal: Nested functions for population dispersal in a disease ecology simulation.

Description

Modular functions for the disease simulator for performing dispersal of segment (stage by compartment) abundance at a specified time step via dispersal rates provided. Dispersal can be handled identically for all stages and compartments, or can be handled differently by stage, compartment, or both.

Usage

disease_dispersal(
  replicates,
  time_steps,
  populations,
  demographic_stochasticity,
  dispersal,
  dispersal_type,
  dispersal_source_n_k = NULL,
  dispersal_target_k = NULL,
  dispersal_target_n = NULL,
  dispersal_target_n_k = NULL,
  stages = NULL,
  compartments = NULL,
  simulator
)

Value

Dispersal function: function(r, tm, carrying_capacity, segment_abundance), where:

r

Simulation replicate.

tm

Simulation time step.

carrying_capacity

Array of carrying capacity values for each population at time step.

segment_abundance

Matrix of abundance for each stage by compartment (rows) and population (columns) at time step.

returns

New stage abundance matrix with dispersal applied.

Arguments

replicates

Number of replicate simulation runs.

time_steps

Number of simulation time steps.

populations

Number of populations.

demographic_stochasticity

Boolean for optionally choosing demographic stochasticity for the transformation.

dispersal

Must be a list. Either a list of matrices of dispersal rates between populations (source columns to target rows) or a list of data frames of non-zero dispersal rates and indices for constructing a compact dispersal matrix, and optionally a list of lists of data frames showing changing rates over time (as per class poems::DispersalGenerator dispersal_data attribute). Alternatively a list of user-defined functions may be used: function(params), where params is a list passed to the function containing:

replicates

Number of replicate simulation runs.

time_steps

Number of simulation time steps.

populations

Number of populations.

stages

Number of life cycle stages.

compartments

Number of disease compartments.

dispersal_type

Must be "pooled", "stages", "compartments", or "segments". This indicates whether dispersal should be handled differently by stage and/or compartment.

demographic_stochasticity

Boolean for optionally choosing demographic stochasticity for the transformation.

dispersal_source_n_k

Dispersal proportion (p) density dependence via source population abundance divided by carrying capacity (n/k), where p is reduced via a linear slope (defined by two list items) from n/k <= cutoff (p = 0) to n/k >= threshold.

dispersal_target_k

Dispersal rate (r) density dependence via target population carrying capacity (k), where r is reduced via a linear slope (through the origin) when k <= threshold.

dispersal_target_n

Dispersal rate (r) density dependence via target population abundance (n), where r is reduced via a linear slope (defined by two list items) from n >= threshold to n <= cutoff (r = 0) or vice versa.

dispersal_target_n_k

Dispersal rate (r) density dependence via target population abundance divided by carrying capacity (n/k), where r is reduced via a linear slope (defined by two list items) from n/k >= threshold to n/k <= cutoff (r = 0) or vice versa.

r

Simulation replicate.

tm

Simulation time step.

carrying_capacity

Array of carrying capacity values for each population at time step.

segment_abundance

Matrix of abundance for each stage by compartment (rows) and population (columns) at time step.

simulator

poems::SimulatorReference object with dynamically accessible attached and results lists.

returns the post-dispersal abundance matrix

dispersal_type

Must be "pooled", "stages", "compartments", or "segments". This indicates whether dispersal should be handled differently by stage and/or compartment.

dispersal_source_n_k

Dispersal proportion (p) density dependence via source population abundance divided by carrying capacity (n/k), where p is reduced via a linear slope (defined by two list items) from n/k <= cutoff (p = 0) to n/k >= threshold or vice versa.

dispersal_target_k

Dispersal rate (r) density dependence via target population carrying capacity (k), where r is reduced via a linear slope (through the origin) when k <= threshold.

dispersal_target_n

Dispersal rate (r) density dependence via target population abundance (n), where r is reduced via a linear slope (defined by two list items) from n >= threshold to n <= cutoff (r = 0) or visa-versa.

dispersal_target_n_k

Dispersal rate (r) density dependence via target population abundance divided by carrying capacity (n/k), where r is reduced via a linear slope (defined by two list items) from n/k >= threshold to n/k <= cutoff (r = 0) or vice versa.

stages

Number of life cycle stages.

compartments

Number of disease compartments.

simulator

poems::SimulatorReference object with dynamically accessible attached and results lists.