disturb_internal: Determine if a disturbance occurred and reduce population...

Description Usage Arguments Value Examples

View source: R/disturb_internal.R

Description

Determine if a disturbance occurred and reduce population abundances in a time step.

Usage

1
2
3
4
5
6
7
disturb_internal(
  N,
  disturb_type,
  disturb_p,
  disturb_value,
  river_network_structure
)

Arguments

N

Abundance matrix with nrow = n_sp = 3 and ncol = n_patch.

disturb_type

Character vector of one of c("regional", or NULL). "regional" applies a disturbance to all patches within the network. If disturb_type = NULL, no disturbances will occur in the simulation. Future releases are intended to include an additional disturbance type for branching river networks: "point-source". Which is intended to apply a disturbance randomly to individual patches, and the magnitude of disturbance will decay downstream. This is not currently implemented.

disturb_p

probability of disturbance occurring. If disturb_type = "regional", disturbance for the entire meta-community is determined in each time step via rbinom(n = 1, size = 1, prob = disturb_p).

disturb_value

Vector of numbers from 0 to 1 describing the magnitude of disturbance i. This is optimized to work with branching river networks generated from the the mcbrnet package by taking the output of df_patch$disturbance from brnet() as an input. See ?brnet for more details. For 2D habitats, this number is sampled randomly by converting the disturb_mag_mean and disturb_mag_sd arguments using the inverse logit function. Currently, the value for each patch is randomly sampled, i.e., there is no spatial correlation. This has not been optimized for 2D habitats

Value

List with two elements. N = abundance matrix after accounting for disturbances. Values don't necessarily have to be integers. Numeric-double values will be converted to integer with rpois() in the simulation function. patch_extinction is an integer vector of length = n_patch indicating if a disturbance did happen (1) or did not happen (0).

Examples

1
disturb_internal(N, disturb_type, disturb_p, disturb_value, river_network_structure)

Jpomz/IGPtoy documentation built on Aug. 2, 2021, 5:28 a.m.