Learn R Programming

learnPopGen (version 1.0.4)

selection: Numerical analysis of biallelic locus frequency independent selection

Description

This function performs numerical analysis of a simple biallelic selection model.

Usage

selection(p0=0.01, w=c(1.0,0.9,0.8), time=100, show="p", pause=0, ...)

Arguments

p0

Starting frequency for the A allele.

w

Fitnesses for the three genotypes in the following order: AA, Aa, aa.

time

Number of generations to run the analysis.

show

Various options for plotting. "p" shows the frequency of A through time; "surface" plots the mean fitness as a function of p; "deltap" shows the change in p as a function of p; "cobweb" creates a cobweb plot showing p(t) by p(t+1). The default is show="p".

pause

Pause between generations. pause=0.01 (for instance) might smooth animation.

...

Optional arguments, including: add, a logical value indicating whether or not to add to the current plot (applies only to show="p"); color, change the color of the plotted line (works nicely with add, for obvious reasons); and equil, a logical value indicating whether or not to show the equilibrium value of p using vertical (or horizontal) lines on the graph (defaults to FALSE).

Value

The function creates one of several possible plots, depending on the value of show.

The cobweb plot shows p(t+1) as a function of p(t), with stairsteps giving the changes across generations given the initial value of p (p0) and total time (time) that are specified by the user.

The function invisibly returns an object of class "selection" which can be printed or re-plotted using associated print and plot methods. (See examples.)

See Also

drift.selection, freqdep, msd, mutation.selection

Examples

Run this code
# NOT RUN {
	selection(w=c(1.0,0.8,0.8),time=500)
	selection(w=c(1.0,1.0,0.0),show="surface")
	object<-selection(w=c(0.8,1.1,0.7))
	print(object)
	plot(object,show="cobweb")
# }

Run the code above in your browser using DataLab