msd {learnPopGen} | R Documentation |
Migration, drift, and selection
Description
Simulates migration, natural selection, and genetic drift. Selection can be in opposite directions in the two populations experiencing gene flow.
Usage
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. |
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 |
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
Examples
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")