Metapopulation simulation

Share:

Description

Simulate a metapopulation with genetic dynamics.

Usage

1
2
3
4
metapop(disp.mat, data, sim.len, n.offspring, carr.cap,
	event.order = c("m.disperse", "f.disperse", "mate", "reproduce"),
	pop.mod = tr.exp.growth, output.interval = NA, m.mult.mating = FALSE,
	mutation = NULL, p.mutation = 0, ...)

Arguments

disp.mat

a square matrix of size n.patches x n.patches containing the dispersal probabilities. The source patches are given in rows, target patches in columns, so disp.mat[i,j] is the probability of transfer from patch i to patch j. If the rows sum to less than one, the sum gives the probability of survival during the dispersal event. On the diagonal (disp.mat[i,i]) are the probabilities of staying in the patch i.

data

a data.frame with columns ‘patch’, ‘sex’, and at least one additional column for allele lengths. Each row describes one individual, or, if column n is present it describes n individuals of the same genotype, sex, and location.

sim.len

numeric, the simulation length (number of time steps).

n.offspring

maximum number of offspring per female. This can be either a numeric scalar or vector of length n.patches, in the latter case values are per patch

carr.cap

numeric scalar or vector of length n.patches, carrying capacity of the patches.

event.order

a character vector giving the sequence of events in a single time step. Accepted values are: "m.disperse", "f.disperse", "mate" and "reproduce". The names may be abbreviated. Note that there may be multiple events of the same type.

pop.mod

function implementing the population model. See pop.model.

output.interval

interval at which the population state is returned (not yet inplemented).

m.mult.mating

logical, is multiple mating of males allowed?

mutation

function to carry out mutations in the 'genome' of one individual. It has to accept a numeric vector as the only argument, and return a numeric vector of the same length.

p.mutation

numeric scalar, the mutation probability

...

further arguments passed to pop.mod

Details

In the data, each two homologous alleles must occur in columns next to each other, e.g. ‘allele1A’, ‘allele1B’, ‘allele2A’, ‘allele2B’, etc.

Value

A data.frame with the same column types as the input data provided as data argument, where rows represent individuals (or genotypes/sex/location and their counts if column n was present) at time = sim.len.

  • patch numeric giving the patch number, referring to the row and column of disp.mat.

  • sex factor with two levels, "F" and "M";

  • n optional, number of individuals of that kind;

  • ... remaining columns contain allele values.

Author(s)

Kamil Bartoń

See Also

pop.model

Examples

1
# TODO