Command line usage

Figure 20.8 at P671.

Initial population are all heterozygotes.

set.seed(13);
demo_population_simulation(6, 30, c(0, 10, 0), c(1, 1, 1), "Small population: Lots of genetic drift");

set.seed(0);
demo_population_simulation(6, 30, c(0, 500, 0), c(1, 1, 1), "Large population: Little genetic drift");

Figure 20.13 at P676.

499bb + 1Bb; WBB = 1.0, WBb = 1.0, Wbb = 0.98 (adjusted to 0.97)

set.seed(57);
demo_population_simulation(6, 900, c(0, 1, 499), c(1,1,0.97), "Natural selection together with genetic
drift")

set.seed(885);
demo_population_simulation(6, 900, c(0, 1, 499), c(1,1,0.97), "Natural selection together with genetic
drift")

Draft vs Selection

set.seed(0);
demo_population_simulation(100, 250, c(0, 490, 10), c(1, 1, 1), 'drift')

demo_population_simulation(100, 250, c(0, 490, 10), c(1, 1, 0.95), 'select A')

Shiny App

shiny::runApp(system.file('shiny/population-genetics-monte-carlo-simulation', package = 'pgmcs'))
shiny::runApp(system.file('shiny/population-genetics-monte-carlo-simulation2', package = 'pgmcs'))

If you get interested in these figures, but feel scared about the code, please refer to vignette('beginner')