Add bookdown index and chapter ordering

This commit is contained in:
Simon 2026-08-19 14:05:19 +01:00
parent 60f6bbef0e
commit 140d44f3db
8 changed files with 114 additions and 1 deletions

View file

@ -1 +0,0 @@
A simple model for allel fixation

46
Chapter_3.Rmd Normal file
View file

@ -0,0 +1,46 @@
---
title: "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")
```
We will see later how this can be adapte to represent change in frequency of cultural traits under different cultrural transmission regimes

3
Chapter_4.Rmd Normal file
View file

@ -0,0 +1,3 @@
---
title: "Chapter 4"
---

19
Chapter_5.Rmd Normal file
View file

@ -0,0 +1,19 @@
---
title: "Chapter 5"
---
Figure 5.3
```{r}
```
Figure 5.8
```{r}
```
Figure 5.9
```{r}
```
Figure 5.11
```{r}
```

12
Chapter_6.Rmd Normal file
View file

@ -0,0 +1,12 @@
---
title: "Chapter 6"
---
CV transmission etc..
Figure 6.4
```{r}
plot(1,1)
```

8
Chapter_9.Rmd Normal file
View file

@ -0,0 +1,8 @@
---
title: "Chapter 9"
---
Figure 9.13
```{r}
```

8
_bookdown.yml Normal file
View file

@ -0,0 +1,8 @@
rmd_files: [
"index.Rmd",
"Chapter_3.Rmd",
"Chapter_4.Rmd",
"Chapter_5.Rmd",
"Chapter_6.Rmd",
"Chapter_9.Rmd"
]

18
index.Rmd Normal file
View file

@ -0,0 +1,18 @@
---
title: "EA Companion"
author: "CE Book Team"
date: "`r Sys.Date()`"
site: bookdown::bookdown_site
output:
bookdown::gitbook:
split_by: section
---
# EA Companion
This is the front page for the Bookdown project.
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```