Lecture 2.1 →
Multivariate inheritance: matrix algebra in R and PCP software
by Stevan J. Arnold (with thanks to Josef Uyeda, Patrick C. Phillips, & Tyler Heather)
In this class session, we will concentrate on using Patrick C. Phillips (PCP) software (h2boot) to estimate and compare G-matrices. If you are unfamiliar or out of practice with matrix algebra, do the following tutorials before class.
Matrix algebra tutorials (do them before class)
Using PCP software (h2boot) to estimate G-matrices (do this in class)
The aim of this exercise is to gain some familiarity with multivariate inheritance. We will gain this familiarity by estimating and comparing genetic variances and covariances for a suite of six traits in two populations of garter snakes. You estimated heritabilities of these traits in one of these populations (inland) in Exercise 1.1
2. Download this data file All_females_2pops.txt and put it in a folder on your desktop.
These are data on six scale count characters for mother and offspring garter snakes sampled from two different populations (inland and coastal). Details on two of these populations and the analysis that follows can be found in Phillips & Arnold 1999 and Arnold & Phillips 1999. Each row in this data file give the population name, family name, and then the values for six scale-count traits (body, mid, mid, ilab, slab, post). In a set of rows with the same family name, the first row gives the counts for an adult female and the subsequent rows give the counts for her female offspring. Missing values are denoted -9999.
3. Run the h2boot program on the PCP website. Here is how to run h2boot on different operating systems:
Download h2boot.exe from this website and save it in the same folder as your data file. Then navigate to the directory containing h2boot.exe and type:
(i). To run the precompiled version, download h2bootMAC from this website and place it in the same directory as your data file. Then navigate to the directory containing both h2bootMAC and the data file and type:
chmod +x h2bootMAC
(ii). To run the Windows version via WINE, you need to make sure you have updated Xcode and Xcode Command Line Tools and you need to install Macports. Go to the Macports install page and follow the quickstart guide on the top. You can make sure Macports is installed by typing the following command in a terminal:
port search wine
which should return the number of ports available (e.g., 5). Information on installing WINE can be found on the “Build Wine, the Macports way” on WINE’s build page. Type in the following command in the terminal:
sudo port install wine-devel
This command can take a little while (~45 minutes for me). Once WINE is installed, cd to the directory that contains h2boot.exe and type:
h2boot.exe will run under WINE. If you don’t have WINE installed, you can open a terminal and type:
sudo add-apt-repository ppa:ubuntu-wine/ppa
sudo apt-get update
sudo apt-get install -y wine1.7
Then, download h2boot.exe and place it in the same directory as your data file. Navigate to the directory containing h2boot.exe and type:
Upon first launch some dependences may be downloaded and installed.
4. Once you see the h2boot command screen, enter the following parameter values:
Note: Initially only 10 selections will appear, but as you enter the choices below the menu will expand to 13 choices.
1) Input file name: all_females_2pops.txt
2) Trait names included in file: yes
3) Output file name: All_females_out.txt
4) Number of bootstrap runs: 1000
5) Random number seed: 1994
6) Create files for bootstrap distributions: no
7) Type of analysis: Parent-off regression w/full-sib ANOVA
8) Only use families with complete data: no
9) Analyzing multiple populations: yes
10) Make population comparisons: yes
11) Bend non-positive definite matrices: yes
12) Automatically order eigenvectors in PCP analysis: yes
enter 0) End selection and run program.
5. Your output file should look like this all_females_out,txt
6. Interpreting the h2boot output.
The following instructions show you how to graph the probability values in your output. Open this file in RStudio:
7. You may also want to examine and plot the bootstrap distributions produced by h2boot.
Follow the instructions in the file below. Open the file below in RStudio.
8. In class discussion we will focus on population comparison of the G-matrices (see Figures 1 and 2 in Phillips & Arnold 1999).
For that discussion we will use the final section of the h2boot output (which shows estimates of matrices under different models of population similarity), but we also need output from a second program, cpcrand.exe. To get out put from that program go back to the PCP website, download cpcrand.exe and place it in the same folder as the data file All_females_2pops. Run cpcrand.exe (in the same way that you ran h2boot). When the command screen comes up, answer the queries as follows:
- Input file name: All_females_2pops.txt
- Trait names included in file: yes
- Output file name: cpc.out
- Number of randomization runs: 1000
- Random number seed: 1996
- Create files for likelihood distributions: yes
- Type of analysis: Parent-off regression w/full-sib ANOVA
- Only use families with complete data: yes
- Bend non-positive definite matrices: yes
- Automatically order eigenvectors in PCP analysis: yes
This program will conduct statistical tests for various models of similarity between the two G-matrices (identity, proportionality, common principal components, etc). Stand by with your output file (cpc.out) for discussion in class. We will compare the cpc.out results for comparison of G-matrices with Table 3 and Figure 3 in Phillips & Arnold 1999.
Your output file should look like this cpc.out