Learn R Programming

learnPopGen (version 1.0.4)

drift.selection: Simulation of genetic drift & natural selection at a biallelic locus

Description

Simulates drift and natural selection at a single biallelic locus within one or various populations.

Usage

drift.selection(p0=0.5, Ne=100, w=c(1,1,1), ngen=400, nrep=10, colors=NULL, ...)

Arguments

p0

starting frequency for the A allele.

Ne

effective population size.

w

fitnesses of the three genotypes: AA, Aa, and aa.

nrep

number of replicate simulations.

ngen

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

colors

colors to use for plotting.

...

optional arguments. Presently the only arguments are type (e.g., "l", "s") and lwd in the plot method.

Value

The function creates a plot and returns an object of class "drift.selelction" consisting of list containing the allele frequency through time for each simulation. This object can be printed or plotted using corresponding methods. (See examples.)

See Also

genetic.drift, selection

Examples

Run this code
# NOT RUN {
	drift.selection()
	p<-drift.selection(p0=0.01,Ne=100,w=c(1,0.9,0.8),ngen=200,nrep=5)
	print(p)
	plot(p)
# }

Run the code above in your browser using DataLab