Moran Model Simulator
$A$ Allele:
$a$ Allele:
Time: 0
Moran Model Simulator Help
Introduction
Welcome to my Moran Model Simulator! Here you can play around with the parameters of the model to see how it affects the population. This page explains what the tool is doing as well as the science behind predicting the behaviour.
Model Definition
This tool is considering a two-allele, one-locus model following a Moran process. Specifically this is a model of an asexual population of $N$ individuals, of which $n$ have an $A$ allele and $N - n$ have an $a$ allele. At each time step, two individuals are chosen at random from the population and the first is copied, whereas the second dies. Therefore over time you witness a change in the allele frequency due to Genetic Drift.
In addition to this, one can add a relative fitness between the two alleles. Since one allele is now more fit, it should be chosen to be copied more often. We model this by giving each $A$ allele weight $(1 + s)$ when we randomly select an individual from the population.
Finally we can also model mutation within the population. During any copy of an individual, it is possible that its allele mutates to the other type. Therefore we can add two parameters $\mu$ and $\nu$, which are the probabilities that $A$ mutates to $a$ and that $a$ mutates to $A$ respectively.
Simulator Usage
This simulator allows you to tune the parameters of the model defined above. By default the settings will be for a population without selection or mutation and starting with equal frequencies. You can then use the sliders or input boxes to set values for these parameters and press New Run to add anothe simulation to the chart (up to 3 can be displayed at any time). Each simulation will track the number of members of the population that have the $A$ allele.
The other two buttons are for clearing things up. The Reset Values button will return the sliders to the their original positions and the Clear Plot button will remove all previous simulations.
Predicting the Outcomes
As long as the relative fitness and rate of mutations are small, one can derive a realtively simple diffusion equation. We can start by writing out the probability that there are $n$ individuals with the allele $A$ at a time $t$. At any time step the number of individuals with the allele $A$ can only increase or decrease by 1 or remain constant. For this reason we can apply the law of total probability to find the following.
$$ P(i, t) = P(i - 1, t - 1) T_{i-1,i} + P(i, t - 1) T_{i,i} + P(i + 1, t - 1) T_{i+1,i} $$Where we have defined $T_{i,j}$ as the probability of going from $i$ individuals to $j$ individuals. Now it is simply a matter of finding these $T$ probabilities. It is useful here to define the mean fitness $\bar\omega$ as this will simplify matters greatly below. $$ \bar\omega = \frac{1}{N} \bigg( n(1 + s) + (N - n) \bigg) $$ We can first consider $T_{i - 1, i}$, in which we must increase the number of $A$ alleles by one. This can be done in two ways;
- An $A$ allele is copied, favoured by selection, then one $a$ allele dies
- An $a$ allele is copied and mutates, then one $a$ allele dies
$T_{i+1,i}$ looks quite similar since we must now decrease the number of $A$ alleles of one. The two ways are;
- An $a$ allele is copied, then one $A$ allele dies
- An $A$ allele is copied, favoured by selection, and mutates then one $A$ allele dies
Finally, there are more options for keeping the number of alleles constant for $T_{i,i}$ and we can consider that these are
- An $A$ allele is copied, favoured by selection, then one $A$ allele dies
- An $a$ allele is copied, then one $a$ allele dies
- An $A$ allele is copied, favoured by selection, and mutates then one $a$ allele dies
- An $a$ allele is copied and mutates, then one $A$ allele dies
Now it is simply a matter of algebraic manipulation in which we can rearrange the terms such that they can be written as derivatives. We also change variables to write our diffusion equation in terms of allele frequency, $x$, rather than an allele count. As well as changing time $t$ to $\tau = \frac{t}{N}$ so that one unit of time in $\tau$ is more equivalent to a generation. This gives the final two-allele one-locus forward diffusion equation as