76 lines
2.8 KiB
Text
76 lines
2.8 KiB
Text
# Chapter 3
|
|
|
|
Figure 3.5
|
|
|
|
Pueblo lineage
|
|
```{r}
|
|
```
|
|
|
|
A simple model for allel fixation
|
|
|
|
Figure 3.13
|
|
```{r}
|
|
# drift vs selection
|
|
set.seed(1)
|
|
N <- 10000 # population size
|
|
gens <- 200 # generations
|
|
p0 <- 0.2 # initial allele frequency
|
|
s <- .1 # selection advantage (fitness of A is 1+s, a is 1)
|
|
|
|
drift <- sel <- numeric(gens + 1)
|
|
drift[1] <- p0
|
|
sel[1] <- p0
|
|
|
|
for (g in 1:gens) {
|
|
# neutral drift
|
|
drift[g + 1] <- rbinom(1, N, drift[g]) / N
|
|
|
|
# selection then drift (haploid fitness model)
|
|
p_after_sel <- (1 + s) * sel[g] / ((1 + s) * sel[g] + (1 - sel[g]))
|
|
sel[g + 1] <- rbinom(1, N, p_after_sel) / N
|
|
}
|
|
matplot(
|
|
cbind(0:gens, 0:gens),
|
|
cbind(drift, sel),
|
|
type = "l", lty = 1, lwd = 4, xlab = "Generation", ylab = "Allele A frequency",
|
|
col = c("grey50", "firebrick"), main = "Neutral drift vs. positive selection"
|
|
)
|
|
abline(h = c(0, 1), lty = 2, col = "gray70")
|
|
legend("topright", c("drift", "selected"), col = c("grey50", "firebrick"), lwd = 2, bty = "n")
|
|
```
|
|
|
|
This type of model which date back from Fisher time, have beenused in Evolutionary Biology for now hundred years. They allow one to make prediction about allele frequency and see how these prediction change if the context change. Below let's look at the exact same model but with a smaller population size:
|
|
|
|
```{r}
|
|
# drift vs selection
|
|
set.seed(1)
|
|
N <- 500 # population size
|
|
gens <- 200 # generations
|
|
p0 <- 0.2 # initial allele frequency
|
|
s <- .1 # selection advantage (fitness of A is 1+s, a is 1)
|
|
|
|
drift <- sel <- numeric(gens + 1)
|
|
drift[1] <- p0
|
|
sel[1] <- p0
|
|
|
|
for (g in 1:gens) {
|
|
# neutral drift
|
|
drift[g + 1] <- rbinom(1, N, drift[g]) / N
|
|
|
|
# selection then drift (haploid fitness model)
|
|
p_after_sel <- (1 + s) * sel[g] / ((1 + s) * sel[g] + (1 - sel[g]))
|
|
sel[g + 1] <- rbinom(1, N, p_after_sel) / N
|
|
}
|
|
matplot(
|
|
cbind(0:gens, 0:gens),
|
|
cbind(drift, sel),
|
|
type = "l", lty = 1, lwd = 4, xlab = "Generation", ylab = "Allele A frequency",
|
|
col = c("grey50", "firebrick"), main = "Neutral drift vs. positive selection"
|
|
)
|
|
abline(h = c(0, 1), lty = 2, col = "gray70")
|
|
legend("topright", c("drift", "selected"), col = c("grey50", "firebrick"), lwd = 2, bty = "n")
|
|
```
|
|
|
|
If you run this we the same seed, you should see the frequency of the allele not under selection increse. This is a famous and well know effect of "Drift" the small the population, the more important will be the impact of drift. It tooks time for evolutionary biologist to understand tht, as Wright and Fisher initial model most often assume an infinite population size. Under such assumption, if the math get simpler, the hide a lot of what happen in real life scenario where population can be small.
|
|
|
|
We will see later how this can be adapte to represent change in frequency of cultural traits under different cultrural transmission regimes
|