Week 6 Multilocus Evolution
In this tutorial, we are going to first go through some tips on how to compare groups in R, and learn the basics of using analysis of variance or ANOVA. We will learn how ANOVA is used to determine whether the means of groups are significantly different from one another. We will then see an example of sophisticated use of ANOVA in evolutionary genetics by performing a QTL analysis using the package qtl
. To do this, we will use data from an F2 cross experiment on the common bed bug Cimex lectularius conducted by Fountain et al. Finally we will return to ANOVA in order to demonstrate that such an approach underlies our QTL analysis. There are some quite advanced R analyses here but we have taken the time to break things down and explain them in detail.
What to expect
In this tutorial we will:
- learn some R-tricks for investigating differences between groups
- learn to test for differences between groups with ANOVA
- perform a QTL analysis on pesticide resistance in bedbugs
- verify our QTL analysis with ANOVA
The evolutionary biology-part of the tutorial makes heavy use of the qtl
package. You will see a lot of functions you have never seen before, and that are specific to working with a particular kind of data. You don’t need to understand exactly how these functions work, but you should have a general understanding of what they do. Sometimes additional information is provided in the footnotes. Remember that you can always access function help pages with ?
.
Getting started
The first thing we need to do is set up the R environment. Today we’ll be using the tidyverse
package once again but we will also use another package called qtl
. First we will need to install this new package. (Remember that you only need to do this once, so you can comment out or delete the line below after installing).
install.packages("qtl")
Once it is installed, we will clear the R environment with rm(list = ls())
22 and then load the two packages.
# clear the R environment
rm(list = ls())
library(tidyverse)
library(qtl)
Note that clearing the R environment when you start a script is good practice to make sure you don’t have any conflicts with previously loaded data.↩︎