Commits

committed ebe6d59

analyses/comparative_r/comparative_r.pdf

Binary file modified.

analyses/comparative_r/knitr/comparative_r.Rnw

` The simplest way to generate a random tree is with the rcoal() function:`
` `
` <<>>=`
`-t <- rcoal( 20 )`
`+t <- rcoal( 30 )`
` plot( t )`
` @`
` `
` vcv`
` @`
` `
`-Now, generate 500 simulated datasets on tree t according to vcv:`
`+Now, generate multiple simulated datasets on tree t according to vcv:`
` `
` `
` <<>>=`
` library(geiger)`
`-D <- sim.char( t, vcv, nsims = 500, model = "brownian", root.state = 0 )`
`+D <- sim.char( t, vcv, nsims = 100, model = "brownian", root.state = 0 )`
` D[,,1]`
` @`
` `
` @`
` `
` `
`+\section{Independent contrasts}`
` `
`+Now construct independent contrasts for each of the three variables:`
` `
`+<<>>=`
`+ic1 <- pic( D[,1,1], t )`
`+ic2 <- pic( D[,2,1], t )`
`+ic3 <- pic( D[,3,1], t )`
`+`
`+cov( cbind( ic1, ic2, ic3 ) )`
`+@`
`+`
`+`
`+`
`+`
`+`
`+This matrix is based on a single simulation, and will differ by chance from the `
`+original vcv matrix that we defined above. `
`+`
`+`
`+`
`+\section{Phylogenetic signal}`
`+`
`+Many studies use \$K\$ \citep{Blomberg:2003jg} to assess the `
`+``phylogenetic signal'' of a character. Under a Brownian motion model on a `
`+phylogenetic tree, a \$K\$ of 1 is expected. For \$K<1\$, relatives resemble each `
`+other less than expected. For \$K>1\$, relatives resemble each `
`+other more than expected.`
`+`
`+This measure has been implemented in the picante library. `
`+`
`+`
`+<<>>=`
`+library(picante)`
`+Kcalc( D[,1,1], t )`
`+@`
`+`
`+Now take a look at \$K\$ for a variable that has been simulated without `
`+consideration of the tree:`
`+`
`+<<>>=`
`+ntips <- length( t\$tip.label )`
`+x <- rnorm( ntips, mean=0, sd=1 )`
`+names(x) <- names( D[,1,1] ) `
`+Kcalc( x, t )`
`+@`
`+`
`+Neither of these values are exactly 1, but it is not clear if the difference `
`+is significant. This can be addressed via randomization tests as implemented `
`+by the phylosignal() function`
`+`
`+`
`+<<>>=`
`+phylosignal( D[,1,1], t )`
`+phylosignal( x, t )`
`+@`
` `
` `
` \section{How this document was made}`

analyses/comparative_r/knitr/references.bib

`+@article{Blomberg:2003jg,`
`+author = {Blomberg, Simon P and Garland, Theodore and Ives, Anthony R},`
`+title = {{Testing for phylogenetic signal in comparative data: behavioral traits are more labile.}},`
`+journal = {Evolution},`
`+year = {2003},`
`+volume = {57},`
`+number = {4},`
`+pages = {717--745},`
`+month = apr,`
`+affiliation = {Department of Biology, University of California, Riverside, California 92521, USA.},`
`+keywords = {phylogenetic methods},`
`+doi = {10.1111/j.0014-3820.2003.tb00285.x},`
`+pmid = {12778543},`
`+language = {English},`
`+read = {Yes},`
`+rating = {0},`
`+date-added = {2012-03-16T16:39:16GMT},`
`+date-modified = {2012-03-22T19:19:07GMT},`
`+abstract = {The primary rationale for the use of phylogenetically based statistical methods is that phylogenetic signal, the tendency for related species to resemble each other, is ubiquitous. Whether this assertion is true for a given trait in a given lineage is an empirical question, but general tools for detecting and quantifying phylogenetic signal are inadequately developed. We present new methods for continuous-valued characters that can be implemented with either phylogenetically independent contrasts or generalized least-squares models. First, a simple randomization procedure allows one to test the null hypothesis of no pattern of similarity among relatives. The test demonstrates correct Type I error rate at a nominal alpha = 0.05 and good power (0.8) for simulated datasets with 20 or more species. Second, we derive a descriptive statistic, K, which allows valid comparisons of the amount of phylogenetic signal across traits and trees. Third, we provide two biologically motivated branch-length transformations, one based on the Ornstein-Uhlenbeck (OU) model of stabilizing selection, the other based on a new model in which character evolution can accelerate or decelerate (ACDC) in rate (e.g., as may occur during or after an adaptive radiation). Maximum likelihood estimation of the OU (d) and ACDC (g) parameters can serve as tests for phylogenetic signal because an estimate of d or g near zero implies that a phylogeny with little hierarchical structure (a star) offers a good fit to the data. Transformations that improve the fit of a tree to comparative data will increase power to detect phylogenetic signal and may also be preferable for further comparative analyses, such as of correlated character evolution. Application of the methods to data from the literature revealed that, for trees with 20 or more species, 92% of traits exhibited significant phylogenetic signal (randomization test), including behavioral and ecological ones that are thought to be relatively evolutionarily malleable (e.g., highly adaptive) and/or subject to relatively strong environmental (nongenetic) effects or high levels of measurement error. Irrespective of sample size, most traits (but not body size, on average) showed less signal than expected given the topology, branch lengths, and a Brownian motion model of evolution (i.e., K was less than one), which may be attributed to adaptation and/or measurement error in the broad sense (including errors in estimates of phenotypes, branch lengths, and topology). Analysis of variance of log K for all 121 traits (from 35 trees) indicated that behavioral traits exhibit lower signal than body size, morphological, life-history, or physiological traits. In addition, physiological traits (corrected for body size) showed less signal than did body size itself. For trees with 20 or more species, the estimated OU (25% of traits) and/or ACDC (40%) transformation parameter differed significantly from both zero and unity, indicating that a hierarchical tree with less (or occasionally more) structure than the original better fit the data and so could be preferred for comparative analyses.},`
`+url = {http://eutils.ncbi.nlm.nih.gov/entrez/eutils/elink.fcgi?dbfrom=pubmed&id=12778543&retmode=ref&cmd=prlinks},`
`+local-url = {file://localhost/Users/cdunn/Dropbox/Library/Application%20Support/Papers2/Articles/2003/Blomberg/Evolution%202003%20Blomberg.pdf},`
`+file = {{Evolution 2003 Blomberg.pdf:/Users/cdunn/Dropbox/Library/Application Support/Papers2/Articles/2003/Blomberg/Evolution 2003 Blomberg.pdf:application/pdf}},`
`+uri = {\url{papers2://publication/doi/10.1111/j.0014-3820.2003.tb00285.x}}`
`+}`
`+`
`+`
`+`
` @article{Felsenstein:1985ua,`
` author = {Felsenstein, J.},`
` title = {{Phylogenies and the Comparative Method}},`