Description Usage Arguments Details Examples
View source: R/finite_selection.R
finite_selection simulates finite Mendelian populations with selection over many generations.
Specify initial allele frequencies, population size, number of generations, selection coefficient, dominance coefficient, and number of replicates.
The simulation produces each generation of the population by randomly selecting 2N (ND) alleles for N (ND) individuals from a gamete pool based on
the allele frequencies as determined by the relative fitnesses of the genotypes.
1 | finite_selection(s, h, p1g2_nr, p2g2_nr, alleles, ND_nr, generations_nr, n_rep)
|
s |
Selection coefficient |
h |
Dominance coefficient |
p1g2_nr |
Allele 1 frequency |
p2g2_nr |
Allele 2 frequency |
alleles |
Allele types (use 1 and 2) |
ND_nr |
Population size |
generations_nr |
Number of generations |
n_reps |
Number simulation replicates |
finite_selection returns three plots:
1) Allele 1 frequency versus number of generations, 2) Observed and expected heterozygosity (expected based on
allele frequencies and drift) versus number of generations, and 3) Wright's F with a loess regression best fit line.
It also returns Fisher's exact tests (fisher.test) comparing the observed genotype counts to the expected
and initial values.
1 | finite_selection(0.5,0.5,0.3,0.7,c(1,2),25,100,100)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.