# Brian OMeara Get out laptop, fire up R.

## Presentation on theme: "Brian OMeara Get out laptop, fire up R."— Presentation transcript:

Brian OMeara http://www.brianomeara.info http://www.youtube.com/watch?v=9R8hpPY_9kY Get out laptop, fire up R

install.packages("ctv") library(ctv) install.views("Phylogenetics") install.packages("corHMM")

Model selection

Likelihood ratio test test statistic = 2(ln L 1 - ln L 0 )

Likelihood ratio test

Posada and Crandal 1998 Likelihood ratio test

Akaike information criterion AIC i = -2 ln L i + k i Truth drops out as a constant -- Burnham and Anderson 2004 AIC is estimator as distance between truth and approximating model

Bayes Factors

Reversible jump MCMC Model 1 Model 2 Model 1

Organize by: QuestionMethod Correlation of herbivory with group living Crepuscular foraging being intermediate between nocturnal and diurnal Biogeography Causes of diversification Rate of trait evolution What limits the number of species Continuous time Markov Chain Birth death process Multivariate normal BiSSE and friends Tree stretching

Flour, sugar, egg, butter, leavening, liquid

Continuous time Markov chain finite state space A, T, G, C woody, herbaceous susceptible, infected, recovered herbivorous, omnivorous, carnivorous 0, 2, 4, 6, 8,..., 100 legs

Per day: What is probability of it leaving the store that day? If it leaves, what is the probability it was paid for? What is the probability it stays in the store two days? Action Bought by adult Bought by child Stolen Probability0.200.100.05

Per t: Action Bought by adult Bought by child Stolen Probability 0.20 /scaling 0.10 /scaling 0.05 /scaling

Per t: Action Bought by adult Bought by child Stolen Rater adult r child r stolen

Per t: From \ To StoreAdultChildThief Store-r store-adult r store-child r store-thief

ABCD A-r AB r AC r AD Br BA -r BC r BD Cr CA r CB -r CD Dr DA r DB r DC - Hypotheses about rates for a single character (are some equal? are some zero?) Hypotheses about correlation between characters Tree inference Ancestral state inference From this basic model:

Continuous time Markov chain finite state space

Currie et al. 2010 Nature

Currie et al. 2010 Nature From \ To A (acephalous) sC (simple chiefdom) cC (complex chiefdom) S (state) A-r A-sC r A-cC r A-S sCr sC-A -r sC-cC r sC-S cCr cC-A r cC-sC -r cC-S Sr S-A r S-sC r S-cC -

Currie et al. 2010 Nature From \ To A (acephalous) sC (simple chiefdom) cC (complex chiefdom) S (state) A-r A-sC r A-cC r A-S sCr sC-A -r sC-cC r sC-S cCr cC-A r cC-sC -r cC-S Sr S-A r S-sC r S-cC - 0 0 0 0 00 00 0

Currie et al. 2010 Nature From \ To A (acephalous) sC (simple chiefdom) cC (complex chiefdom) S (state) A-r A-sC r A-cC r A-S sCr sC-A -r sC-cC r sC-S cCr cC-A r cC-sC -r cC-S Sr S-A r S-sC r S-cC - 0 0 0 0 00

Currie et al. 2010 Nature From \ To A (acephalous) sC (simple chiefdom) cC (complex chiefdom) S (state) A-r A-sC r A-cC r A-S sCr sC-A -r sC-cC r sC-S cCr cC-A r cC-sC -r cC-S Sr S-A r S-sC r S-cC -

Currie et al. 2010 Nature

From \ To A (acephalous) sC (simple chiefdom) cC (complex chiefdom) S (state) A-medsmall sCmed-largemed cCmedlarge-med S -

00 11 AA 00 11AA BB BB No sex play Yes sex play No social play Yes social play

From \ To 0A0A0B0B1B1B1A1A 0A0A-r0A-0Br0A-0B r0A-1Br0A-1B r0A-1Ar0A-1A 0B0Br0B-0Ar0B-0A -r0B-1Br0B-1B r0B-1Ar0B-1A 1B1Br1B-0Ar1B-0A r1B-0Br1B-0B -r1B-1Ar1B-1A 1A1Ar1A-0Ar1A-0A r1A-0Br1A-0B r1A-1Br1A-1B -

0A0A0B0B1B1B1A1A 0A0A-r0A-0Br0A-0B r0A-1Br0A-1B r0A-1Ar0A-1A 0B0Br0B-0Ar0B-0A -r0B-1Br0B-1B r0B-1Ar0B-1A 1B1Br1B-0Ar1B-0A r1B-0Br1B-0B -r1B-1Ar1B-1A 1A1Ar1A-0Ar1A-0A r1A-0Br1A-0B r1A-1Br1A-1B - 0 0 00

00 11 AA 00 11AA BB BB No sex play Yes sex play No social play Yes social play

00 11 AA 00 11AA BB BB No sex play Yes sex play No social play Yes social play

Pagel 1994 From \ To0A0A0B0B1B1B1A1A 0A0A-r0A-0Br0A-0B 0r0A-1Ar0A-1A 0B0Br0B-0Ar0B-0A -r0B-1Br0B-1B 0 1B1B0r1B-0Br1B-0B -r1B-1Ar1B-1A 1A1Ar1A-0Ar1A-0A 0r1A-1Br1A-1B -

Barker & Pagel 2005

00 11 11 00 1111 00 00

12345678910111213141516 1a 2ab 3bc 4cd 5de 6ef 7fg 8gh 9hi 10ij 11jk 12kl 13lm 14mn 15no 16o... up to maximum number of genes... where a, b, etc. are just f(i, j, birthdeath rate)

Ree & Smith 2008

Courtesy Nicolas Salamin

Joint: Choose values for x, y, z, w that together maximize likelihood

Marginal: Choose value for x (and repeat for others) that maximizes likelihood while integrating over all values for y, z, w

Joint: Choose values for x, y, z, w that together maximize likelihood Marginal: Choose value for x (and repeat for others) that maximizes likelihood while integrating over all values for y, z, w Henry Hargreaves

Finnigan, G. C., V. Hanson-Smith, T. H. Stevens, and J. W. Thornton. 2012. Evolution of increased complexity in a molecular machine. Nature 481:360-U143.

Courtesy Nicolas Salamin

Equal: all states equally likely Empirical: count the proportion of each state in the tip taxa Fixed: make them up (ideally, based on knowledge) Equilibrium: what they'd be if the process ran forever This assumption can have a major effect on results

Schluter et al. 1997

Beaulieu, O'Meara, and Donoghue, 2013

Tree stretching

Continuous -r AB × tr AC × tr AD × t r BA × t-r BC × tr BD × t r CA × tr CB × t-r CD × t r DA × tr DB × tr DC × t- e ( ) Discrete

Lambda = multiply internal branch lengths 1 0.5 0

Delta = speed up or slow down 1 1.5 0.5

Kappa = raise each branch to kappa. Punctuational models. 0.5 0 1

Eldredge and Gould 1971

¿=?

Schematic illustration of evolution of one phenotype on a phylogeny leading to three extant species. Cladogenetic change appears as vertical lines as it is modeled here as an instantaneous event on a geological time scale. Anagenetic change appears as Brownian motion of the phenotype on a logarithmic scale. S h indi- cates the speciation events that do not appear on a reconstructed phylogeny but did contribute to phenotypic evolution of the extant species, and S indicates a speciation event that can be ob- served in a reconstructed phylogeny. In the resulting branching Brownian motion, species E and F are separated by three speciation events of which two contributed to the phenotypic difference between E and F. F and G are separated by four events that all four contributed to the present phenotypic difference between F and G. Bokma 2008

Eldredge and Gould 1971 =

Two rate: apply different rate before and after some point (in this case, midpoint) 1 2 after 0.2 after

What questions can we answer with tree stretching?

H et er oge neity

Smith and Donoghue. Rates of Molecular Evolution Are Linked to Life History in Flowering Plants. Science (2008) Trees/sh rubs Herbs Substitutions/MY

Meredith et al. 2011, Science

OMeara 2012

Yang 1994

OMeara 2012

Pagel and Meade 2004 Familiar Mixture model Note: likely used a window, not mentioned, though

OMeara 2012

Tree stretching Heterogeneity Tree stretching + Heterogeneity Continuous methods Ysome Discrete methods Ynope

OMeara 2012

library(geiger) ?fitContinuous ?fitDiscrete #Look at some Geospiza examples. Is the rate of beak depth evolution dropping in Darwins finches? library(geiger) ?fitContinuous ?fitDiscrete #Look at some Geospiza examples. Is the rate of beak depth evolution dropping in Darwins finches? http://www.youtube.com/watch?v=BZG14R5p6Kghttp://www.youtube.com/watch?v=h6fqrDShlMM

MADDISON. Confounding asymmetries in evolutionary diversification and character change. Evolution (2006) vol. 60 (8) pp. 1743-1746

0011 q 01 q 10 speciation 0 speciation 1 extinction 0 extinction 1

MADDISON. Confounding asymmetries in evolutionary diversification and character change. Evolution (2006) vol. 60 (8) pp. 1743-1746

Goldberg et al. 2010