Learn R Programming

learnPopGen (version 1.0.4)

phenotype.freq: Computes phenotypic distribution and its change through time due to natural selection on a polygenic trait

Description

phenotype.freq computes the phenotypic trait distribution for a polygenic trait. Can be used to demonstrate that the phenotypic distribution of a polygenic trait will tend to normality as the number of loci is increased, regardless of the allele frequencies at each locus.

phenotype.selection computes the change in the phenotypic trait distribution through time under natural selection. Can be used to show that natural selection on a polygenic trait can move the value of the trait well beyond its original distribution in the population.

Usage

phenotype.freq(nloci=6, p=NULL, effect=1/nloci)
	phenotype.selection(nloci=6, p=NULL, effect=1/nloci, beta=0.1, ngen=20, ...)

Arguments

nloci

number of loci. For simplicity all loci are assumed to be biallelic.

p

allele frequency, p, for each locus, in a vector. If not supplied, initially frequencies will be assumed to be 0.5 at all loci.

effect

additive effect of an allele substitution. For simplicity, this is assumed to be the same at all loci.

beta

selection gradient.

ngen

number of generations to analyze.

...

optional arguments. Presently the only optional argument in the function phenotype.selection is sleep, which can be used to specify the time delay in seconds between generations.

Value

Creates a plot or animation.

phenotype.freq also invisibly returns an object of class "phenotype.freq" that can be printed or re-plotted using print and plot methods corresponding to the object type. (See examples.)

See Also

clt, selection

Examples

Run this code
# NOT RUN {
	
# }
# NOT RUN {
		phenotype.freq(n=4)
		object<-phenotype.freq(nloci=6,p=runif(n=6),effect=1/6)
		print(object)
		plot(object)
		object<-phenotype.freq(nloci=10,p=runif(n=10),effect=rexp(n=10))
		print(object)
		plot(object)
		phenotype.selection(ngen=100)
	
# }

Run the code above in your browser using DataLab