msd: Migration, drift, and selection

Description Usage Arguments Value Author(s) See Also Examples

View source: R/evolution.R

Description

Simulates migration, natural selection, and genetic drift. Selection can be in opposite directions in the two populations experiencing gene flow.

Usage

1
2
	msd(p0=c(0.5,0.5), Ne=c(100,100), w=list(c(1,1,1),c(1,1,1)), 
		m=c(0.01,0.01), ngen=400, colors=c("red","blue"), ...)

Arguments

p0

starting frequency for the A allele in each of two populations.

Ne

effective population size for each of two populations.

w

fitnesses of the three genotypes (AA, Aa, and aa, in that order) in each of the two populations. w should take the form of a list of two vectors.

m

rates of migration from the first population to the second, and from the second population to the first, in that order. This value is best interpreted as the probability that an individual born in population 1 will migrate to population 2 before reproduction, and vice versa.

ngen

total time, in number of generations, for the simulation.

colors

colors to use for plotting.

...

optional arguments. Presently, the only optional argument for msd is show.legend (which defaults to TRUE). The plot method adds the additional optional arguments of colors (a vector of colors for the two simulated populations), lwd, and type (e.g., "l" or "s").

Value

The function creates a plot and invisibly returns a list containing the allele frequency through time for each of the two simulated populations.

The returned object is of class "msd" and can be printed or re-plotted using corresponding print or plot methods. (See examples.)

Author(s)

Liam Revell liam.revell@umb.edu

See Also

drift.selection

Examples

1
2
3
4
5
6
	msd()
	msd(p0=c(0.25,0.75),w=list(c(1,0.9,0.8),c(0.8,0.9,1)))
	object<-msd(p0=c(0.75,0.25),w=list(c(1,0.9,0.8),
		c(0.8,0.9,1)),m=c(0.1,0.1),ngen=100)
	print(object)
	plot(object,colors=c("black","grey"),lwd=4,type="s")

Example output

sh: 1: cannot create /dev/null: Permission denied
sh: 1: cannot create /dev/null: Permission denied

Object of class "msd" containing the results from a numerical simulation
of drift, selection, and migration within and between two populations.

The following parameters were used in the simulation:
	Ne[1]	Ne[2]
	 100	100
	m[1->2]	m[2->1]
	 0.1	0.1
        w(AA) w(Aa) w(aa)
pop'n 1   1.0   0.9   0.8
pop'n 2   0.8   0.9   1.0


To plot enter plot('object_name') at the command line interface.

learnPopGen documentation built on May 21, 2019, 1 a.m.