# Exercise: effects of population size and mutation rate on population dynamics

We’ll go into this further in the next section, but a very important parameter is *θ*, which is equal to 2*Nμ*, where *N* is equal to the population size and *μ* is equal to mutations per generation. If there are 100 sites and a per-site per-gen mutation rate of 0.0001, then *μ* = 0.01. If there are 50 individuals in the population, then *θ* = 2*Nμ* = 1.

This exercise can be completed by running the supplied Python script `mutation-drift.py`

. To run the script with population size of 50, per-site per-gen mutation rate of 0.0001, 100 sites and 500 generations, input:

```
python mutation-drift.py --pop_size 50 --mutation_rate 0.0001 --seq_length 100 --generations 500
```

Again, these parameters give *θ* = 1.

(1) Keeping the above parameters as baseline, adjust population size up and down to vary

θbetween ~0.2 and ~5. What happens to diversity, divergence and haplotype dynamics?

(2) Keeping the above parameters as baseline, adjust mutation rate up and down to vary

θbetween ~0.2 and ~5. Again, what happens to diversity, divergence and haplotype dynamics?

(3) Adjust

Nandμup and down, while keepingθ= 1, to explore highN/ lowμand lowN/ highμscenarios. What happens to diversity, divergence and haplotype dynamics?

You might try increasing `generations`

to something greater than 500 to get a better feel for equilibrium divergence and diversity, say `--generations 2500`

. In this case, it may be easier to not plot the haplotype trajectories. This can be done with `--summary`

, like so:

```
python mutation-drift.py --pop_size 50 --mutation_rate 0.0001 --seq_length 100 --generations 2500 --summary
```