make_mig: Create Migration Matrix.

View source: R/Utility_functions.R

make_migR Documentation

Create Migration Matrix.

Description

Function to create a migration matrix from x,y coordinates or pairwise distance matrix.

Usage

make_mig(site.arrange, max.dist, tot)

Arguments

site.arrange

Matrix or Distance object. Either a two column matrix with x-values \(i.e. longitude\) in the first column and y-values (i.e. latitude) in the second column or a pairwise distance object between each site.

max.dist

Numeric, the maximum distance the species can migrate.

tot

Numeric, a value between 0 and 1 detailing the probability of migration.

Details

This function creates a matrix of migration probabilities where cell ij is the probability for a species to migrate from community j to community i. Migration probablities are calculated by dividing the total probability of migrating into proportions between all the communities that the species can reach according to the max.dist parameter. Proportions are set up so that they are inversely related to the distance travelled, i.e. the further the distance between sites the lower the probability of migrating between sites. If x,y coordinates are given, pairwise euclidean distances are calcuted and used.

Value

Returns a mumeric matrix where cell ij is the probability of the species migrating from community j to community i.

Examples

xy <- matrix(sample(50, 10), ncol = 2)
make_mig(xy, 20, .1)

pairdist <- dist(xy)
make_mig(pairdist, 20, .1)


trevorjwilli/CommSimABCR documentation built on Feb. 4, 2025, 1:22 a.m.