In Chapter 4, Population Genetics, we used Python to analyze population genetics datasets based on real data. In this chapter, we will look at how we can use Python to simulate population genetics data. From teaching, to developing new statistical methods, to analyzing the performance of existing methods, simulated datasets have plenty of applications.
There are two kinds of simulation: one is the coalescent, going backward in time, while the second is forward-time simulation. Coalescent simulation is computationally less expensive because only the most recent generation of individuals needs to be completely rendered; previous generations only need parents of the next generation to be maintained. On the other hand, this severely limits what can be simulated because we need to complete populations to make decisions on, for example, which individuals mate. Forward-time...