R/population-simulation.R
population_simulation.Rd
simulate genetic drift in a finite population for one gene with two alleles
population_simulation(ngeneration, population, fitness = c(1, 1, 1))
integer scalar. Number of generations
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.
numeric vector. The fitness value of AA, Aa and aa. c(1, 1, 1)
means no natural selection.
numeric vector. The frequency of allele A.
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