[R-sig-phylo] randomizing clades within a node
Hello I would very much appreciate if someone can help me with this one. I wish to compare two additive trees that are identical for some but not all the clades. So I use rtree of the ape package with, say, 10 tips to generate tree "A". Then I wish to modify "A" to get tree "B" by randomizing the clades and patristic distances in a given number of nodes. If the number of nodes is, for instance, three, the 3 nodes furthest apart from the origin will be randomized. Then "A" and "B" will be compared. The whole procedure needs to be carried out a large number of times (10,000). Any help would be much appreciated. Juan A. Balbuena -- Dr. Juan A. Balbuena Marine Zoology Unit Cavanilles Institute of Biodiversity and Evolutionary Biology University of Valencia http://www.uv.es/~balbuena P.O. Box 22085 http://www.uv.es/cavanilles/zoomarin/index.htm 46071 Valencia, Spain http://cetus.uv.es/mullpardb/index.html e-mail: j.a.balbu...@uv.es tel. +34 963 543 658 fax +34 963 543 733 NOTE! For shipments by EXPRESS COURIER use the following street address: C/ Catedrtico Jos Beltrn 2, 46980 Paterna (Valencia), Spain. ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
[R-sig-phylo] Lambda; PIC vs. PGLS
Dear all I am currently analysing a set of traits from different species - let's say brain size and body mass - using a tree where branch lengths were set artificially (after Graphen) as the length was not available. I calculate phylogenetic independent contrasts (PIC) using the package caper and the crunch-algorithm. Beforehand, I used the function caic.diagnostic to test whether the model is appropriate (which was the case). In the end, this provided me with a significant correlation between brain size and body mass. I then calculate lambda as a measurement for phylogenetic signal, using the package ape: data - comparative.data(tree, data, Species) result - gls(brainsize~bodymass, data = data, correlation = corPagel(value = 1, phy = tree, fixed = FALSE), method = ML) summary(result) Here, lambda was 1, which - as far as I understood - means evolution under Brownian motion. I perform a phylogenetic generalised least square (PGLS) regression using caper, which includes lambda, as an addition to the PIC analysis: data - comparative.data(tree, data, Species, vcv = TRUE) Mod1 - pgls(brainsize~bodymass, data = data, lambda = ML) summary(Mod1) Surprisingly, lambda here was zero. Furthermore, the correlation between brain size and body mass became non-significant. I now have two contradiction values for lambda and results from both PIC and PGLS that differ dramatically in the way they can be interpreted. How does it come that with one method, lambda is zero and with the other lambda is one? And in the end, which method should be used, PIC or PGLS, or should both be discussed? I would be grateful for advice.Thank you very much in advance for your help. Best regards Karin Schneeberger PhD candidate in Ecology and Evolution [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Re: [R-sig-phylo] Lambda; PIC vs. PGLS
Hi Karin. gls(...,correlation=corPagel(...,fixed=F),method=ML) and pgls(...,lambda=ML) should produce the same result unless one or the other is not optimizing properly or unless different bounds on the fitted model parameters (in particular, lambda) are used. To show this to yourself, you can try the following example which simulates and then fits the same model using three different functions. I hope this is helpful. - Liam set.seed(1) require(phytools); require(caper); require(nlme); require(geiger) # simulate tree tree-pbtree(n=100,scale=1) # simulate x under BM x-fastBM(tree) # simulate y residual error under the lambda model y-0.4*x+fastBM(lambdaTree(tree,0.7),sig2=0.5) data-as.data.frame(cbind(x,y)) data-cbind(names(x),data) colnames(data)-c(Species,x,y) # fit using nlme:gls r1-gls(y~x,data=data,correlation=corPagel(0.5,tree,fixed=FALSE),method=ML) # fit using caper:pgls r2-pgls(y~x,data=comparative.data(tree,data,Species),lambda=ML) # fit using phytools:phyl.resid r3-phyl.resid(tree,x,y,method=lambda) -- Liam J. Revell University of Massachusetts Boston web: http://faculty.umb.edu/liam.revell/ email: liam.rev...@umb.edu blog: http://phytools.blogspot.com On 1/13/2012 6:04 AM, Karin Schneeberger wrote: Dear all I am currently analysing a set of traits from different species - let's say brain size and body mass - using a tree where branch lengths were set artificially (after Graphen) as the length was not available. I calculate phylogenetic independent contrasts (PIC) using the package caper and the crunch-algorithm. Beforehand, I used the function caic.diagnostic to test whether the model is appropriate (which was the case). In the end, this provided me with a significant correlation between brain size and body mass. I then calculate lambda as a measurement for phylogenetic signal, using the package ape: data- comparative.data(tree, data, Species) result- gls(brainsize~bodymass, data = data, correlation = corPagel(value = 1, phy = tree, fixed = FALSE), method = ML) summary(result) Here, lambda was 1, which - as far as I understood - means evolution under Brownian motion. I perform a phylogenetic generalised least square (PGLS) regression using caper, which includes lambda, as an addition to the PIC analysis: data- comparative.data(tree, data, Species, vcv = TRUE) Mod1- pgls(brainsize~bodymass, data = data, lambda = ML) summary(Mod1) Surprisingly, lambda here was zero. Furthermore, the correlation between brain size and body mass became non-significant. I now have two contradiction values for lambda and results from both PIC and PGLS that differ dramatically in the way they can be interpreted. How does it come that with one method, lambda is zero and with the other lambda is one? And in the end, which method should be used, PIC or PGLS, or should both be discussed? I would be grateful for advice.Thank you very much in advance for your help. Best regards Karin Schneeberger PhD candidate in Ecology and Evolution [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo