simulate genetic drift in a finite population for one gene with two alleles

population_simulation(ngeneration, population, fitness = c(1, 1, 1))

Arguments

ngeneration

integer scalar. Number of generations

population

integer vector. How many dominant homozygotes, heterozygotes, and recessive homozygotes do the initial population contain. For example, c(2, 5, 3) means 2 AA, 5 Aa and 3 aa.

fitness

numeric vector. The fitness value of AA, Aa and aa. c(1, 1, 1) means no natural selection.

Value

numeric vector. The frequency of allele A.

Examples

population_simulation(30, c(0, 10, 0))
#>  [1] 0.50 0.50 0.45 0.40 0.45 0.35 0.50 0.50 0.70 0.75 0.80 0.85 0.90 0.95 0.95
#> [16] 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00