Re: [R-sig-phylo] variation in rates over time, unexpected message when using Brownie.lite
People, many thanks for keeping this list so functional. Sorry for the slow reply, had a small accident, but is ok now. I'll answer Liam first and Ted and Brian in sequence. Liam, yes, the error is fatal, and the BrownieREML worked. But seems it did not converged: These are the results: > brownieREML(tree,data[,"Area_Km2"],maxit=2000)$sig2.single [1] 6.444619e+12 $logL1 [1] -135.4347 $sig2.multiple 2 4.911978e+12 $logL2 [1] -135.6168 $convergence [1] FALSE Also tried the Ouwie option, but then I needed to generate a simmap.tree. Tried with make.simmap but the help tells me it only works for discrete data, and my response variable is continuous. To be more informative, I pasted below a very small graph of the uncorrected relationship I want to analyze using phylogenetic methods. Ted and Brian, thanks for you advice and references on number of species. Im comparing nearly all known syntopic species of two sister clades with different morphs. I know thats inappropriate for inferring adaptation and for estimating several parameters from such a low number of species. However, I expected to be able to reliably recover the differences between the two groups and the degree to which phylogeny was explaining the relationships. However, for this case, as my data are highly heteroskedastic (see graph below) and the differences between the treatments is related to the maximum value that the response variable attains, do you think that adding a outgroup and performing a Bartlets test over phylogenetic contrasts would at least make a honest test of the relationship? Agus [image: Imágenes integradas 1] 2012/9/18 Theodore Garland Jr > That number of 20 comes up from the simulations provided by both of these > papers: > > Blomberg, S. P., T. Garland, Jr., and A. R. Ives. 2003. Testing for > phylogenetic signal in comparative data: behavioral traits are more labile. > Evolution 57:717-745. > > Freckleton, R. P., P. H. Harvey, and M. Pagel. 2002. Phylogenetic analysis > and comparative data: a test and review of evidence. Am. Nat. 160:712-726. > > Note, however, that both of those sets of simulations assumed no > measurement error in the phenotypic trait(s) and no error in the > phylogenetic topology or branch lengths. Hence, they may well have > underestimated how many species you need in the real world! As they say, > your mileage may vary ... > > Cheers, > Ted > > Theodore Garland, Jr. > Professor > Department of Biology > University of California, Riverside > Riverside, CA 92521 > Office Phone: (951) 827-3524 > Facsimile: (951) 827-4286 = Dept. office (not confidential) > Email: [email protected] > http://www.biology.ucr.edu/people/faculty/Garland.html > http://scholar.google.com/citations?hl=en&user=iSSbrhwJ > > Experimental Evolution: Concepts, Methods, and Applications of Selection > Experiments. 2009. > Edited by Theodore Garland, Jr. and Michael R. Rose > http://www.ucpress.edu/book.php?isbn=9780520261808 > (PDFs of chapters are available from me or from the individual authors) > > > From: [email protected] [[email protected]] > on behalf of Brian O'Meara [[email protected]] > Sent: Tuesday, September 18, 2012 1:25 PM > To: Agus Camacho > Cc: [email protected] > Subject: Re: [R-sig-phylo] variation in rates over time, unexpected > message when using Brownie.lite > > That's a fairly small tree to be doing this with -- an old rule of thumb (I > think from Pagel) is 20 tips per parameter. Common issues are zero length > (or effectively zero length) branch lengths (what is min(phy$edge.length)?) > and polytomies (methodologically not a problem, but many packages don't > deal well with these). > > Brian > > ___ > Brian O'Meara > Assistant Professor > Dept. of Ecology & Evolutionary Biology > U. of Tennessee, Knoxville > http://www.brianomeara.info > > Students wanted: Applications due Dec. 15, annually > Postdoc collaborators wanted: Check NIMBioS' website > Calendar: http://www.brianomeara.info/calendars/omeara > > > On Tue, Sep 18, 2012 at 4:08 PM, Agus Camacho >wrote: > > > Dear all, I tried to test something similar to Jason, but relating the > > change in rates to the acquisition of a trait, instead to a specific > date. > > > > For that, I used a phylogeny with ten taxa, without outgroup. > > I used exactly the same script gently proposed by Liam but got the > > following error message: > > "Error in solve.default(model1$hessian) :Lapack routine dgesv: system is > > exactly singular" > > > > I've been looking through the internet but was
Re: [R-sig-phylo] variation in rates over time, unexpected message when using Brownie.lite
That number of 20 comes up from the simulations provided by both of these papers: Blomberg, S. P., T. Garland, Jr., and A. R. Ives. 2003. Testing for phylogenetic signal in comparative data: behavioral traits are more labile. Evolution 57:717-745. Freckleton, R. P., P. H. Harvey, and M. Pagel. 2002. Phylogenetic analysis and comparative data: a test and review of evidence. Am. Nat. 160:712-726. Note, however, that both of those sets of simulations assumed no measurement error in the phenotypic trait(s) and no error in the phylogenetic topology or branch lengths. Hence, they may well have underestimated how many species you need in the real world! As they say, your mileage may vary ... Cheers, Ted Theodore Garland, Jr. Professor Department of Biology University of California, Riverside Riverside, CA 92521 Office Phone: (951) 827-3524 Facsimile: (951) 827-4286 = Dept. office (not confidential) Email: [email protected] http://www.biology.ucr.edu/people/faculty/Garland.html http://scholar.google.com/citations?hl=en&user=iSSbrhwJ Experimental Evolution: Concepts, Methods, and Applications of Selection Experiments. 2009. Edited by Theodore Garland, Jr. and Michael R. Rose http://www.ucpress.edu/book.php?isbn=9780520261808 (PDFs of chapters are available from me or from the individual authors) From: [email protected] [[email protected]] on behalf of Brian O'Meara [[email protected]] Sent: Tuesday, September 18, 2012 1:25 PM To: Agus Camacho Cc: [email protected] Subject: Re: [R-sig-phylo] variation in rates over time, unexpected message when using Brownie.lite That's a fairly small tree to be doing this with -- an old rule of thumb (I think from Pagel) is 20 tips per parameter. Common issues are zero length (or effectively zero length) branch lengths (what is min(phy$edge.length)?) and polytomies (methodologically not a problem, but many packages don't deal well with these). Brian ___ Brian O'Meara Assistant Professor Dept. of Ecology & Evolutionary Biology U. of Tennessee, Knoxville http://www.brianomeara.info Students wanted: Applications due Dec. 15, annually Postdoc collaborators wanted: Check NIMBioS' website Calendar: http://www.brianomeara.info/calendars/omeara On Tue, Sep 18, 2012 at 4:08 PM, Agus Camacho wrote: > Dear all, I tried to test something similar to Jason, but relating the > change in rates to the acquisition of a trait, instead to a specific date. > > For that, I used a phylogeny with ten taxa, without outgroup. > I used exactly the same script gently proposed by Liam but got the > following error message: > "Error in solve.default(model1$hessian) :Lapack routine dgesv: system is > exactly singular" > > I've been looking through the internet but was not able to identify what > causes this error. Any hint about that? > > BTW, anybody knows how to directly answer a message found in the digest of > the mail list, without leaving the thread? > > Below, I pasted the complete thread dealing with this topic. > > Cheers, > Agus > > Message: 9 > Date: Tue, 18 Sep 2012 00:13:00 -0400 > From: "Brian O'Meara" > To: Jason S > Cc: "[email protected]" > Subject: Re: [R-sig-phylo] variation in rates over time > Message-ID: > < > cakywhkq-jjroqzdvfutphi4xopxam+aaacu64nldb3inxoz...@mail.gmail.com> > Content-Type: text/plain > > I agree with the suggestions so far. I just wanted to point out a few more > alternatives: > > You could use the geiger package to estimate the best scaling for the > tworatetree transformation to do this (should be equivalent to the earlier > solutions, though it would require running optimization). > > You could also use the OUwie package with a tree that has been given simmap > mappings using phytools. The advantage of this is that you could evaluate > Brownian models but you could also look at various Ornstein-Uhlenbeck > models (though note that while there is information about different > Brownian rates before and after a time slice, info about different alphas > (strength of pull parameter) and thetas (the attractor, aka "optimal > value") is rapidly (but not immediately) lost under an OU process). > > For completeness, especially for citations, note that O'Meara et al. (2006) > and Thomas et al. (2006) independently arrived at essentially the same > method, so it is worth reading both papers. > > Best, > Brian > > ___ > Brian O'Meara > Assistant Professor > Dept. of Ecology & Evolutionary Biology > U. of Tennessee, Knoxville > http://www.brianomeara.info
Re: [R-sig-phylo] variation in rates over time, unexpected message when using Brownie.lite
That's a fairly small tree to be doing this with -- an old rule of thumb (I think from Pagel) is 20 tips per parameter. Common issues are zero length (or effectively zero length) branch lengths (what is min(phy$edge.length)?) and polytomies (methodologically not a problem, but many packages don't deal well with these). Brian ___ Brian O'Meara Assistant Professor Dept. of Ecology & Evolutionary Biology U. of Tennessee, Knoxville http://www.brianomeara.info Students wanted: Applications due Dec. 15, annually Postdoc collaborators wanted: Check NIMBioS' website Calendar: http://www.brianomeara.info/calendars/omeara On Tue, Sep 18, 2012 at 4:08 PM, Agus Camacho wrote: > Dear all, I tried to test something similar to Jason, but relating the > change in rates to the acquisition of a trait, instead to a specific date. > > For that, I used a phylogeny with ten taxa, without outgroup. > I used exactly the same script gently proposed by Liam but got the > following error message: > "Error in solve.default(model1$hessian) :Lapack routine dgesv: system is > exactly singular" > > I've been looking through the internet but was not able to identify what > causes this error. Any hint about that? > > BTW, anybody knows how to directly answer a message found in the digest of > the mail list, without leaving the thread? > > Below, I pasted the complete thread dealing with this topic. > > Cheers, > Agus > > Message: 9 > Date: Tue, 18 Sep 2012 00:13:00 -0400 > From: "Brian O'Meara" > To: Jason S > Cc: "[email protected]" > Subject: Re: [R-sig-phylo] variation in rates over time > Message-ID: > < > cakywhkq-jjroqzdvfutphi4xopxam+aaacu64nldb3inxoz...@mail.gmail.com> > Content-Type: text/plain > > I agree with the suggestions so far. I just wanted to point out a few more > alternatives: > > You could use the geiger package to estimate the best scaling for the > tworatetree transformation to do this (should be equivalent to the earlier > solutions, though it would require running optimization). > > You could also use the OUwie package with a tree that has been given simmap > mappings using phytools. The advantage of this is that you could evaluate > Brownian models but you could also look at various Ornstein-Uhlenbeck > models (though note that while there is information about different > Brownian rates before and after a time slice, info about different alphas > (strength of pull parameter) and thetas (the attractor, aka "optimal > value") is rapidly (but not immediately) lost under an OU process). > > For completeness, especially for citations, note that O'Meara et al. (2006) > and Thomas et al. (2006) independently arrived at essentially the same > method, so it is worth reading both papers. > > Best, > Brian > > ___ > Brian O'Meara > Assistant Professor > Dept. of Ecology & Evolutionary Biology > U. of Tennessee, Knoxville > http://www.brianomeara.info > > Students wanted: Applications due Dec. 15, annually > Postdoc collaborators wanted: Check NIMBioS' website > Calendar: http://www.brianomeara.info/calendars/omeara > > > On Mon, Sep 17, 2012 at 9:11 PM, Jason S wrote: > > > > > > > Thanks, guys. That's exactly what I needed. > > > > > > > > From: Liam J. Revell > > To: Matt Pennell > > > > -project.org> > > Sent: Monday, September 17, 2012 9:22 PM > > Subject: Re: [R-sig-phylo] variation in rates over time > > > > Hi Jason. Matt is absolutely correct. You can do this with phytools. > > Say, for instance, you have an ultrametric phylogeny with branches in > > millions of years (tree) and data vector containing the trait values for > > species (x) and you want to test the hypothesis that the last 3.4 my has > > a different rate of evolution than the rest of the tree, you could do > > this as follows: > > > > library(phytools) # load phytools > > tree<-make.era.map(tree,c(0,max(nodeHeights(tree))-3.4)) > > plotSimmap(tree,pts=F,lwd=3) # visualize > > fit<-brownie.lite(tree,x) # fit model > > > > That's it. Good luck. Liam > > > > Liam J. Revell, Assistant Professor of Biology > > University of Massachusetts Boston > > web: http://faculty.umb.edu/liam.revell/ > > email: [email protected] > > blog: http://phytools.blogspot.com > > > > On 9/17/2012 7:46 PM, Matt Pennell wrote: > > > > > Jason, > > > > > > I think the best way to do this is with the approach of O'Meara et al. > > 2006 > > > Evolution "Brownie". > > > > > > Liam Revell has implemented this in R in his package phytools. You can > > > modify the steps taken in this tutorial here > > > > > > > http://phytools.blogspot.com/2011/07/running-brownielite-for-arbitrarily.html > > > perhaps > > > in conjunction with the function make.era.map() > > > > > > http://phytools.blogspot.com/2011/10/new-function-to-plot-eras-on-tree.html > > > though > > > I admittedly have not tried this myself. > > > > > > Perhaps Liam or someone else has a better
Re: [R-sig-phylo] variation in rates over time, unexpected message when using Brownie.lite
Hi Agus. It looks like in your example the Hessian matrix of partial second derivatives (the curvature) at the optimum is numerically singular. I'm not sure what this means - it could be that the surface is very flat, or alternatively that it is highly correlated. Is the error fatal, or do you get a result? The Hessian matrix is only used to estimate standard errors of the fitted parameter values, so if the option to compute the variances from the Hessian could be turned off (not possible in the present version), presumably the analysis would run through. Another option is to use brownieREML in phytools or, as Brian pointed out yesterday, the OUwie package. brownieREML is a "lighter" REML version of brownie.lite, which does not compute the Hessian or the standard errors on parameter estimates. OUwie is a separate package that uses phytools mapped trees to do the analyses of brownie.lite in one of its functions. All the best, Liam Liam J. Revell, Assistant Professor of Biology University of Massachusetts Boston web: http://faculty.umb.edu/liam.revell/ email: [email protected] blog: http://phytools.blogspot.com On 9/18/2012 4:08 PM, Agus Camacho wrote: Dear all, I tried to test something similar to Jason, but relating the change in rates to the acquisition of a trait, instead to a specific date. For that, I used a phylogeny with ten taxa, without outgroup. I used exactly the same script gently proposed by Liam but got the following error message: "Error in solve.default(model1$hessian) :Lapack routine dgesv: system is exactly singular" I've been looking through the internet but was not able to identify what causes this error. Any hint about that? BTW, anybody knows how to directly answer a message found in the digest of the mail list, without leaving the thread? Below, I pasted the complete thread dealing with this topic. Cheers, Agus Message: 9 Date: Tue, 18 Sep 2012 00:13:00 -0400 From: "Brian O'Meara" To: Jason S Cc: "[email protected]" Subject: Re: [R-sig-phylo] variation in rates over time Message-ID: Content-Type: text/plain I agree with the suggestions so far. I just wanted to point out a few more alternatives: You could use the geiger package to estimate the best scaling for the tworatetree transformation to do this (should be equivalent to the earlier solutions, though it would require running optimization). You could also use the OUwie package with a tree that has been given simmap mappings using phytools. The advantage of this is that you could evaluate Brownian models but you could also look at various Ornstein-Uhlenbeck models (though note that while there is information about different Brownian rates before and after a time slice, info about different alphas (strength of pull parameter) and thetas (the attractor, aka "optimal value") is rapidly (but not immediately) lost under an OU process). For completeness, especially for citations, note that O'Meara et al. (2006) and Thomas et al. (2006) independently arrived at essentially the same method, so it is worth reading both papers. Best, Brian ___ Brian O'Meara Assistant Professor Dept. of Ecology & Evolutionary Biology U. of Tennessee, Knoxville http://www.brianomeara.info Students wanted: Applications due Dec. 15, annually Postdoc collaborators wanted: Check NIMBioS' website Calendar: http://www.brianomeara.info/calendars/omeara On Mon, Sep 17, 2012 at 9:11 PM, Jason S wrote: Thanks, guys. That's exactly what I needed. From: Liam J. Revell To: Matt Pennell -project.org> Sent: Monday, September 17, 2012 9:22 PM Subject: Re: [R-sig-phylo] variation in rates over time Hi Jason. Matt is absolutely correct. You can do this with phytools. Say, for instance, you have an ultrametric phylogeny with branches in millions of years (tree) and data vector containing the trait values for species (x) and you want to test the hypothesis that the last 3.4 my has a different rate of evolution than the rest of the tree, you could do this as follows: library(phytools) # load phytools tree<-make.era.map(tree,c(0,max(nodeHeights(tree))-3.4)) plotSimmap(tree,pts=F,lwd=3) # visualize fit<-brownie.lite(tree,x) # fit model That's it. Good luck. Liam Liam J. Revell, Assistant Professor of Biology University of Massachusetts Boston web: http://faculty.umb.edu/liam.revell/ email: [email protected] blog: http://phytools.blogspot.com On 9/17/2012 7:46 PM, Matt Pennell wrote: Jason, I think the best way to do this is with the approach of O'Meara et al. 2006 Evolution "Brownie". Liam Revell has implemented this in R in his package phytools. You can modify the steps taken in this tutorial here http://phytools.blogspot.com/2011/07/running-brownielite-for-arbitrarily.html perhaps in conjunction with the function make.era.map() http://phytools.blogspot.com/2011/10/new-function-to-plot-eras-on-tree.html though I admi
Re: [R-sig-phylo] variation in rates over time, unexpected message when using Brownie.lite
Dear all, I tried to test something similar to Jason, but relating the change in rates to the acquisition of a trait, instead to a specific date. For that, I used a phylogeny with ten taxa, without outgroup. I used exactly the same script gently proposed by Liam but got the following error message: "Error in solve.default(model1$hessian) :Lapack routine dgesv: system is exactly singular" I've been looking through the internet but was not able to identify what causes this error. Any hint about that? BTW, anybody knows how to directly answer a message found in the digest of the mail list, without leaving the thread? Below, I pasted the complete thread dealing with this topic. Cheers, Agus Message: 9 Date: Tue, 18 Sep 2012 00:13:00 -0400 From: "Brian O'Meara" To: Jason S Cc: "[email protected]" Subject: Re: [R-sig-phylo] variation in rates over time Message-ID: Content-Type: text/plain I agree with the suggestions so far. I just wanted to point out a few more alternatives: You could use the geiger package to estimate the best scaling for the tworatetree transformation to do this (should be equivalent to the earlier solutions, though it would require running optimization). You could also use the OUwie package with a tree that has been given simmap mappings using phytools. The advantage of this is that you could evaluate Brownian models but you could also look at various Ornstein-Uhlenbeck models (though note that while there is information about different Brownian rates before and after a time slice, info about different alphas (strength of pull parameter) and thetas (the attractor, aka "optimal value") is rapidly (but not immediately) lost under an OU process). For completeness, especially for citations, note that O'Meara et al. (2006) and Thomas et al. (2006) independently arrived at essentially the same method, so it is worth reading both papers. Best, Brian ___ Brian O'Meara Assistant Professor Dept. of Ecology & Evolutionary Biology U. of Tennessee, Knoxville http://www.brianomeara.info Students wanted: Applications due Dec. 15, annually Postdoc collaborators wanted: Check NIMBioS' website Calendar: http://www.brianomeara.info/calendars/omeara On Mon, Sep 17, 2012 at 9:11 PM, Jason S wrote: > > > Thanks, guys. That's exactly what I needed. > > > > From: Liam J. Revell > To: Matt Pennell > > -project.org> > Sent: Monday, September 17, 2012 9:22 PM > Subject: Re: [R-sig-phylo] variation in rates over time > > Hi Jason. Matt is absolutely correct. You can do this with phytools. > Say, for instance, you have an ultrametric phylogeny with branches in > millions of years (tree) and data vector containing the trait values for > species (x) and you want to test the hypothesis that the last 3.4 my has > a different rate of evolution than the rest of the tree, you could do > this as follows: > > library(phytools) # load phytools > tree<-make.era.map(tree,c(0,max(nodeHeights(tree))-3.4)) > plotSimmap(tree,pts=F,lwd=3) # visualize > fit<-brownie.lite(tree,x) # fit model > > That's it. Good luck. Liam > > Liam J. Revell, Assistant Professor of Biology > University of Massachusetts Boston > web: http://faculty.umb.edu/liam.revell/ > email: [email protected] > blog: http://phytools.blogspot.com > > On 9/17/2012 7:46 PM, Matt Pennell wrote: > > > Jason, > > > > I think the best way to do this is with the approach of O'Meara et al. > 2006 > > Evolution "Brownie". > > > > Liam Revell has implemented this in R in his package phytools. You can > > modify the steps taken in this tutorial here > > > http://phytools.blogspot.com/2011/07/running-brownielite-for-arbitrarily.html > > perhaps > > in conjunction with the function make.era.map() > > > http://phytools.blogspot.com/2011/10/new-function-to-plot-eras-on-tree.html > > though > > I admittedly have not tried this myself. > > > > Perhaps Liam or someone else has a better explanation but I hope this is > at > > least somewhat helpful. > > > > cheers, > > matt > > > > > > >> > >> > >> > Hello, > >> > >> I see that there are several interesting alternatives to test for > >> different rates among clades. However, I was wondering if there is a > method > >> to test for varying rates over time. I'm aware of Pagel's delta and the > EB > >> model, but I was thinking more in terms of testing if there is a > different > >> rate for the entire tree after a specified point in time. For instance, > if > >> a snail predator colonizes an island 3.4 Mya, is there evidence for an > >> increased rate of evolution in the prey after that point in time? > Something > >> like two lambdas, one for before and one for after that point in time. > >> > >> Thanks! > >> > >> Jason > >> [[alternative HTML version deleted]] > >> > >> ___ > >> R-sig-phylo mailing list > >> [email protected] > >> https://stat.ethz.ch/mailman/listinfo/r-
