M-S Balance - Simulation
Adjust the selection coefficient s, and the mutation rate to the right:
When the mutation rate is set to 0.0, q remains at 0.0 because no mutant alleles are introduced into the population. As is increased, the equilibrium value of q becomes greater as mutation becomes a stronger force. As s is increased, conversely, the equilibrium value of q decreases. The opposing forces of selection and mutation balance out after only a few generations, where q remains relatively constant.
In this simulation, the yellow line represents the frequency of q in a population of 5000 individuals. The current q value is also displayed in the top right of the figure. The red line represents the frequency as calculated using the first two equations in the equations section simultaneously.
Because the population size isn't infinite, there is some variation in q after equilibrium has been reached. Note, however, that the frequency never deviates too far from the projected value. This can be seen by pressing the run button several times for a set of conditions without pressing reset button. The frequency is held in check by the opposing forces of selection and mutation.