This function performs numerical analysis of a frequency dependent selection model based on Rice (2004; Evolutionary Theory: Mathematical & Conceptual Foundations). The fitnesses of the three genotypes in the model are as follows, where f(XX) denotes the frequency of the XX genotype: w(AA)=1-3*f(Aa)+3*f(aa); w(Aa)=1-s*f(Aa); and w(aa)=1-3*f(Aa)+3*f(AA). As shown in Rice (2004), though entirely deterministic, the model can exhibit chaotic behavior under some values for s
.
freqdep(p0=0.01, s=0, time=100, show="p", pause=0, ...)
Starting frequency for the A allele.
Parameter that determines the strength of selection against heterozygotes when they are common.
Number of generations to run the analysis.
Various options for plotting. "p"
shows the frequency of A through time; "q"
gives the frequency of the a allele; "fitness"
gives the mean population fitness 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 between generations. pause=0.01
(for instance) might smooth animation.
optional arguments. Presently, the only optional argument in freqdep
is color
, which can be used to change the color of the lines of the plot. The plot
method can also accept the optional arguments type
(e.g., "l"
or "s"
) and lwd
.
The function creates one of several possible plots, depending on the value of show
.
The use of cobweb plots follows selection
.
The function also invisibly returns an object of class "freqdep"
containing the frequency of the allele A through time, if this was calculated by the selected method. This can be printed or plotted using the corresponding methods. (See examples.)
# NOT RUN {
freqdep(time=100)
freqdep(s=1.5,time=100)
p<-freqdep(s=2,show="cobweb",time=100)
plot(p)
# }
Run the code above in your browser using DataLab