Tuesday, May 17, 2016

Exercise 2: Coding with pizza

Exercise 2: Coding with pizza

1. Reconstruct ancestral states for snout-vent length (SVL) for Phelsuma geckos.

2. Is there a standard correlation between ln(SVL) and ln(jaw) across the species of Phelsuma geckos? Is there an evolutionary correlation? What do you conclude?

3. Day geckos can be classified by island group, as listed below. Use ancestral state reconstructions to investigate the dispersal of geckos across islands.

Species Island
abbotti Seychelles
astriata Seychelles
borbonica Mauritius
cepedianaA Mauritius
dubia Madagascar
guentheri Mauritius
guttata Madagascar
laticauda Madagascar
lineata Madagascar
grandis Madagascar
mutabilis Madagascar
ornata Mauritius
quadriocellata Madagascar
longinsulae Seychelles
standingi Madagascar
sunbergi Seychelles
barbouri Madagascar
guimbeaui Mauritius
comorensis Comoros
robertmertensi Comoros

Exercise 1: Comparative data in R

Exercise 1: Comparative data in R

1. Read in the data phelsuma.csv. Describe the data set. How many species are included? How many variables?

2. Read in the tree phel2.phy. Plot the tree. Is it ultrametric?

3. Do the names match in the two data sets? If not, make a tree and data set that do match using treedata().


4. Reroot the tree using the species “ornata” as an outgroup.

Comparative methods workshop - 18 May 2016 Leipzig

Comparative Methods in R
18 May, 2016
iDiv, Leipzig, Germany

Welcome to this short course in comparative methods in R. The course materials can be found here.

Files you will need:

anolisDataAppended.csv
anolis.phy
multiple_trees.phy
phel2.phy
phelsuma.csv

Review materials:

basics.R
Also see this intro to basic R.

My files from the day
zip file

Schedule

9:00 - 9:30 AM 
Lecture 1: What is the point of comparative methods? pdf

9:30 - 10:00 AM 
Demonstration 1: Reading trees into R, matching tip data R script

10:00 - 10:30 AM 
Exercise 1: Comparative data in R
answer is here - along with all of the things I did in the morning session!

10:30 - 10:45 AM - Coffee break

10:45 - 11:00 AM
Lecture 2: What is a phylogenetic correlation? pdf

11:00 - 11:30 AM
Demonstration 2: PICs, PGLS, and ancestral states R script

12:30 - 2:00 PM - Lunch

2:00 - 2:30 PM
Lecture 3: Fitting macroevolutionary models to data pdf

2:30 - 3:00 PM
Demonstration 3: Fitting models using geiger code

3:00 - 3:30 PM
Exercise 3: Which model is the best exercise

3:30 - 3:45 PM - Coffee break

3:45 - 4:15 PM
Demonstration 4: Plotting using phytools code

4:15 - 5:00 PM
Wrap-up exercise: lightning analysis

5:15 - 5:30 PM
Presentations of lightning analysis

Friday, January 10, 2014

Tuesday, January 7, 2014

Comp methods in Bogota, Jan. 2013

Welcome to the short course on comparative methods, held in Bogota, Colombia at the Universidad de los Andes as a part of NNB3. On this blog I will post both data and scripts that you can use to carry out the analyses that you learned in the course.

R scripts:
Part 1: Introduction to comparative methods in R
Part 1
Part 2: Comparative analysis of single variables
Part 2
Part 3: Comparative analyses of two (or more!) variables
Part 3

Actual R scripts from the workshop
morning
afternoon

Files you will need:
anolisDataAppended.csv
anolis.phy
multiple_trees.phy
phel2.phy
phelsuma.csv

Challenge questions:

Problem set 1
(for after “part 1”)
(“x” = “optional” for now, you can do these later if you don’t have time; skip to non-x questions first):


1. Create a vector called "vec" that contains the numbers 1:500. Have r report the mode, length, and class of that vector


2. Create a matrix called "dataSet" that has the following elements:
0.1 1 10
0.2 2 12
0.3 3 14
0.4 4 16
Print out only the third column of this matrix. Find the mean of the third column.


x3. r has a function called var(). Find out how it works using the help page. Then find the variance of the vector z<-1:1000.


x4. Create a plot of y=x^2 where x ranges from -5 to 5.


5. Read in the data phelsuma.csv. Describe the data set. How many species are included? How many variables?


6. Read in the tree phel2.phy. Plot the tree. Is it ultrametric?


7. Do the names match in the two data sets? If not, make a tree and data set that do match using treedata().


x8. Reroot the tree using the species “ornata” as an outgroup.


Problem set 2 (for after “part 2”)
(“x” = “optional” for now, you can do these later if you don’t have time; skip to non-x questions first):


1. Carry out a test for phylogenetic signal in ln(svl) for the gecko species.


2. Reconstruct ancestral states for ln(svl) in these geckos. Make a plot to show your results.


3. Use fitContinuous to compare the fit of Brownian motion, OU, and Early Burst among these gecko species.


4. (challenge) Create a new variable that is “TRUE” for geckos with SVL greater than 50 mm, and “FALSE” otherwise. (hint: “>” does this; e.g. the R command “x > 4” returns a vector with TRUE for every x > 4 and FALSE otherwise). Reconstruct ancestral character states for this vector, and plot your results.


Problem set 3 (for after “part 3)


1. Is there an evolutionary correlation between ln(SVL) and ln(jaw) across the species of Phelsuma geckos?


2. (challenge) There is a function in geiger called “sim.char” that allows you to simulate data on a phylogenetic tree. Use this function to simulate a new continuous and a new discrete variable for your geckos. Check the help file for sim.char for some examples, and try to replicate them.

3. (challenge) Run the "auteur" analysis - an "extra" in the R scripts that I supply above - on both anoles and day gecko body size evolution.