diff --git a/Chapter_2.Rmd b/Chapter_2.Rmd deleted file mode 100644 index 4534267..0000000 --- a/Chapter_2.Rmd +++ /dev/null @@ -1 +0,0 @@ -A simple model for allel fixation diff --git a/Chapter_3.Rmd b/Chapter_3.Rmd new file mode 100644 index 0000000..6b89f11 --- /dev/null +++ b/Chapter_3.Rmd @@ -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 +} +aĆ” +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 + diff --git a/Chapter_4.Rmd b/Chapter_4.Rmd new file mode 100644 index 0000000..490c9d1 --- /dev/null +++ b/Chapter_4.Rmd @@ -0,0 +1,3 @@ +--- +title: "Chapter 4" +--- diff --git a/Chapter_5.Rmd b/Chapter_5.Rmd new file mode 100644 index 0000000..f716b2a --- /dev/null +++ b/Chapter_5.Rmd @@ -0,0 +1,19 @@ +--- +title: "Chapter 5" +--- + +Figure 5.3 +```{r} +``` +Figure 5.8 +```{r} +``` + +Figure 5.9 +```{r} +``` + +Figure 5.11 +```{r} +``` + diff --git a/Chapter_6.Rmd b/Chapter_6.Rmd new file mode 100644 index 0000000..fb37c8b --- /dev/null +++ b/Chapter_6.Rmd @@ -0,0 +1,12 @@ +--- +title: "Chapter 6" +--- + +CV transmission etc.. + +Figure 6.4 + +```{r} +plot(1,1) +``` + diff --git a/Chapter_9.Rmd b/Chapter_9.Rmd new file mode 100644 index 0000000..bbff2d9 --- /dev/null +++ b/Chapter_9.Rmd @@ -0,0 +1,8 @@ +--- +title: "Chapter 9" +--- + +Figure 9.13 +```{r} +``` + diff --git a/_bookdown.yml b/_bookdown.yml new file mode 100644 index 0000000..efe9980 --- /dev/null +++ b/_bookdown.yml @@ -0,0 +1,8 @@ +rmd_files: [ + "index.Rmd", + "Chapter_3.Rmd", + "Chapter_4.Rmd", + "Chapter_5.Rmd", + "Chapter_6.Rmd", + "Chapter_9.Rmd" +] diff --git a/index.Rmd b/index.Rmd new file mode 100644 index 0000000..9ece832 --- /dev/null +++ b/index.Rmd @@ -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) +``` +