Search This Blog by Google

Search This Blog

Welcome to Dijemeric Visualizations

Where photography and mathematics intersect with some photography, some math, some math of photography, and an occasional tutorial.

Total Pageviews

Thursday, May 03, 2012

Using a Monte-Carlo Simulation to Model Natural Selection

Using a Monte-Carlo Simulation to Model Natural Selection

Ken Osborn © 2012

Darwin postulated that natural selection was the driver of the evolution of species diversity[1].   Elements of this model include 1) a selective agent as a reproductive threshold, 2) genetic variability (plasticity), and 3) a continuing process of genetic variation with each succeeding population.   In the Darwinian model of evolution, natural selection provides a reproductive threshold.  Individuals within a population whose genetics allow them to leave more offspring when challenged by the threshold determine the genetic direction of the population and the process leads to a “more fit” population, where fitness is defined in terms of the population’s ability to adapt to the threshold.  If the selective agent threshold is too high, the population may become extinct. 

For example, if color variation within a population of moths allows some moths to escape predator detection then predation pressure would act as a selective agent that would result in a change in distribution and abundance of color expression within the moth population.  Of course, the difficulty of finding camouflaged moths could act on the predator population as a selective agent driving changes that improved their abilities to detect prey.  Another example would be the effect of climatic variation on a population of Pika.  If genetic variation within the Pika population was insufficient to provide some individuals who could survive and reproduce in the presence of shifting summer temperatures, the Pika population would become extinct. 

Mathematically these elements can be modeled.  I have written a program in Excel using a Monte-Carlo process to generate a population of values that can evolve into another population of values in a “natural selection” process.  In the model, two numbers define a starting population: 1) the population average (mean) which represents Darwinian fitness, and 2) population relative standard deviation which represents genetic plasticity.  Once a threshold is set, the program generates a new population of values using the mean and relative standard deviation (RSD).  The Monte-Carlo equations generate a Normal distribution of values with mean = 0 and standard deviation = 1.  These values are converted using the population mean (fitness) and RSD (genetic plasticity).  Population values that exceed the threshold become the basis for the next population.  The process can be repeated with or without a new threshold. 

There are several observations I have made from this model.  Some seem reasonable and others are counter-intuitive.  All are potential candidates for testing, though some might be trivial and others cost-prohibitive.  I leave the testing for others to pursue. 

Figure 1 is an example of the program output.  The distribution of values will be referred to as a population.  Fitness is the average value of the population.  Spread is the standard deviation.  Plasticity is the relative standard deviation (RSD).   Adaptation is the percentage of a distribution that exceeds a threshold.  Options allow for specifying an initial and challenge threshold, where the challenge threshold is set at a level just below extinction.  The extinction threshold is one that exceeds the highest value in a population.  Survivors refer to population values that exceed a threshold.

The blue curve is for the initial population, Generation 1.  The vertical axis represents values of the population and the horizontal axis is the count of values (i.e., there are 100 individuals in the population).   The values have been sorted to provide a less complex visualization of the population distributions.  Individual values in Generation1 vary from a low of 159 to a high of 257 with a fitness mean of 203 and a plasticity RSD of 10.  Values of Generation 1 that exceed the initial threshold of 230 are used to create Generation 2.  A challenge threshold (250) was used to create Generation 4 from Generation 3 (not shown).  The table above the plot summarizes the population statistics for each succeeding generation. 

Figure 1: Monte-Carlo Evolution Program Output Example  (Run 1)

The most obvious observation is that there is variability around the mean fitness value.  Generation 1 ranges from a minimum of 159 to a maximum of 257.  Note that the relative range between maximum and minimum values decreases with each succeeding generation.  I will discuss this more.  That there is variability within a population is a trivial observation given that these numbers are generated using a random Monte-Carlo process, but it is worth noting. 

The second observation is that for a given set of initial fitness, genetic plasticity, and selective threshold the final outcome is only generally predictable.  Each run of the program will generate a slightly different outcome.  Figure 2 shows the second run with the same starting inputs for mean, plasticity, and threshold values as the first run shown in Figure 1.  The changes are small with a change in mean fitness for Generation 1 from 203 to 204, 241 to 240 for Generation 2, and 255 to 254 for Generation 4.

Figure 2: Run #2 for Initial Settings of Mean =200, RSD = 10, and Threshold = 230. 

Again, because this is a Monte-Carlo process this is a trivial observation.  The driver of genetic plasticity is genetic mutation, a constraint driven but random processes. A biological population with a specified fitness level and genetic plasticity would not respond exactly the same way to each instance of a natural selection challenge even if it were the exactly the same repeated challenge.  If this conclusion is generally valid, the implication is that smaller population size would lead to lower adaptability. 

The third observation is that for a given fitness and plasticity, there is a maximum threshold.  Setting the threshold above the maximum causes the program to crash.  I refer to this as the extinction threshold.  Because it is a Monte-Carlo process, there is variability in the extinction threshold.   A setting that causes a population crash in one run may not result in a crash in the next run.  In fact, the challenge threshold for Generation 4 of 250 was initially set high and was expected to result in a program crash (extinction).  It did on the third run, as seen in Figure 3. Generation 3 had no survivors to contribute to Generation 4. 

Figure 3: Setting the threshold above extinction

What happens if the genetic plasticity is increased?  If the initial fitness is fixed, changing the plasticity would be comparable to having two biological populations with the same overall average fitness but with different ranges from maximum to minimum fitness.  Figure 4 shows what happens when the plasticity for the first run is doubled from 10% to 30%.  Figure 4 shows that the fitness for Generations 2 and 4 has increased relative to run 1 even though the thresholds have not changed.  Generation 4, for example, went from a mean fitness of 256 to 285.  The increase for Generation 1 from 199 to 205 is within the run-to-run variability and not significant though the increase of the population maximum for an individual value from 243 to 334 is.  Note that it would not be expected for the fitness of Generation 1 to change with an increase (or decrease) in plasticity as it was not challenged with a threshold. 

Figure 4: Increasing genetic plasticity

At first it would appear that an increase in plasticity may not be of value as it not only leads to an increase in the maximum values in the population (243 to 334 for Generation 1), but also decreases in the minimum values (from 153 to 104 for Generation1).  Figure 5 used the input conditions for Run 3 with an increase in the Challenge Threshold from 250 to 280.


Figure 5: Increasing the Challenge Threshold after an increase in plasticity but a fixed initial fitness

The Challenge Threshold is set to affect only Generation 4 and the results are consistent with that condition.  The mean fitness of Generation 2 shows a modest increase, but is within the run-to-run reproducibility.  Generation 4, however, shows a much larger increase from 285 to 300 and both the max and min values have increased.  The significance for a biological population is that even if the population has some individuals that are well below the mean fitness, the population as a whole may be more responsive to environmental challenges. 

In this model of evolution, is genetic plasticity or genetic fitness a better predictor of adaptability?  I have rewritten the model to allow for multiple runs with a single set of input values for fitness, plasticity, and threshold.  The percentage of values exceeding a threshold (PECT) is a measure of adaptability. 

The model was run twenty times for each set of plasticity and fitness.  Column 1 is the Run number, column 2 is population 1 with fitness of 220 and a plasticity of 10, and column 4 is population 2 with fitness of 190 and a plasticity of 40.  The data are presented in Table 2 (note that there is no Table 1).  In this example, population 2 with the higher plasticity has the higher PECT (57.8 vs 11).  

This is somewhat counter-intuitive.  Consider if the players in a football team at school A were very evenly matched and all could bench press 200 plus or minus 10 pounds while players at school B could press 190 plus or minus 40 pounds.  You might think that the team with the well matched players and the higher average bench press capabilities would be more capable of achieving a 250 pound bench press challenge.  But in fact only 11% of team A could do that while 58% of team B could meet that challenge.

This mathematical model of evolution is a simple one and does not capture the complexity of biological evolution.  For example, predator-prey interactions, group selection, and eco-system feedback loops are not part of this model.  Given its simplicity, however, it has provided a surprising number of testable hypotheses:

  1. Increased genetic plasticity increases adaptability.
  2. There are limits to adaptability for a given plasticity and genetic fitness: a selection threshold that is too high will result in extinction. 
  3. In an environment where the threshold is changing, adaptation to a challenge threshold is greater for the population that has been subjected to the higher non-extinction threshold below the challenge threshold.
  4. As the selection threshold increases, genetic plasticity of a population decreases.
  5. Genetic plasticity can be a better predictor of adaptability than population fitness.

If you would like a copy of the 'Evolution' program, please write me.  You may use the program for your own purposes or post on your blog with credit.  You may not use the program for commercial purposes. Write me at  

[1] Charles Darwin, "On the Origin of Species by Means of Natural Selection, or the Preservation of Favoured Races in the Struggle for Life," 1859.

No comments: