joe@GENETICS.WASHINGTON.EDU (Joe Felsenstein) (03/11/91)
In response to Erkki Aalto's request regarding how to simulate multiple allele natural selection in a finite population. It's pretty straightforward. After selection has occurred, you have (new) frequencies of all n-squared genotypes. You want to use random numbers to choose N of these to survive at random. If you can order the genotypes somehow (any way is OK) and call them G_1 through G_k, you can compute the cumulate frequencies Y_1, Y_1+Y_2, Y_1+Y_2+Y_3 and so on. Call these C_1, C_2, ... Then you choose a random number (assumed to be between 0 and 1) and find out for which j is C_(j-1) < r < C_j. This determines what is the genotype of the survivor. Toting up the numbers of the genotypes among the N survivors, one gets a set of genotype frequencies from which the next generation is bred. This is basically just sampling from a multinomial distribution; there are also trickier and faster ways to do it, which can be looked up in books on statistical simulations. ----- Joe Felsenstein, Dept. of Genetics, Univ. of Washington, Seattle, WA 98195 Internet: joe@genetics.washington.edu (IP No. 128.95.12.41) Bitnet/EARN: felsenst@uwavm UUCP: ... uw-beaver!evolution.genetics!joe