# 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.000025, then *μ* = 0.0025. If there are 200 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 200, per-site per-gen mutation rate of 0.000025, 100 sites and 1000 generations, input:

```
python mutation-drift.py --pop_size 200 --mutation_rate 0.000025
```

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 1000 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 200 --mutation_rate 0.000025 --generations 2500 --summary
```

Alternatively, if you don’t have a working local Python install, you can run the `mutation-drift.ipynb`

notebook online with MyBinder: