dispersal_n: Calculate number of individuals dispersing from patch i to j

Description Usage Arguments Details Value Examples

View source: R/dispersal_n.R

Description

Calculate number of individuals dispersing from patch i to j

Usage

1
2
3
4
5
6
7
8
9
dispersal_n(
  N,
  v_p_dispersal,
  v_theta,
  dist_mat,
  m_b_dispersal,
  m_c_dispersal,
  m_p_dispersal
)

Arguments

N

Abundance matrix with nrow = n_sp = 3 and ncol = n_patch. Rows 1:3 correspond to species B, C, and P respectively.

v_p_dispersal

A vector of dispersal probabilities of length = 3. in igp_sim(), this is controlled with the p_dispersal argument. Values should be from 0 to 1

v_theta

Vector of length = 3, Parameters controlling the distance decay function. Larger values of theta result in a faster decline of dispersal distance. v_theta is caluclated internally in igp_sim based on the theta argument.

dist_mat

a distance matrix with nrow = ncol = n_patch and diagonal == 0.

m_b_dispersal

dispersal matrix for species B. This and the following 2 matrices are calculated internally in igp_sim()

m_c_dispersal

dispersal matrix for species C.

m_p_dispersaldispersal

matrix for species P.

Details

This function is used internally in igp_sim() to calculate the number of individuals of each dispersing from patch i to patch j. Emigrants from patch i are more likely to become Immigrants to patch j if the patches are closer together.

Value

A matrix of abundances after accounting for dispersal with nrow = n_sp = 3 and ncol = n_patch. Values may be returned with decimal values, but will be converted to integers using rpois() within the simulation model.

Examples

1
2
3
4
5
6
7
8
n_patch = 5
n_sp = 3
N = matrix(rpois(n_sp * n_patch, lambda = 10), nrow = n_sp, ncol = n_patch)
# sort coordinates so you can easily see increasing distances
 x_coord = sort(runif(5, 0, 5))
 y_coord = sort(runif(5, 0, 5))
 dist_mat = data.matrix(dist(cbind(x_coord, y_coord)))
disperal_n(N = N, v_p_dispersal = 0.25, theta = 1, dist_mat = dist_mat)

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