tag:blogger.com,1999:blog-8499895524521663926.post2952356662738352826..comments2021-10-19T15:29:43.582-04:00Comments on Phylogenetic Tools for Comparative Biology: Fitting Pagel's λ for a single trait using multiple methodsLiam Revellhttp://www.blogger.com/profile/04314686830842384151noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-8499895524521663926.post-91237250282599382652012-01-24T16:44:10.880-05:002012-01-24T16:44:10.880-05:00This is fantastic Rob.
Yes, as I alluded, I was i...This is fantastic Rob.<br /><br />Yes, as I alluded, I was initially perplexed as to why phylosig was faster (as I made no attempt to be computationally economic) but then I realized it is because it does only univariate optimization, using the conditional MLEs of sigma^2 and the root state.<br /><br />An obvious alternative is to do REML estimation of λ based on contrasts; however Rob's suggestion, to use the algorithm of Felsenstein (1973), is even better. This could certainly be used to speed up likelihood calculation for other models as well.<br /><br />For those not familiar with this article, I recently discovered that it is available online, evidently for free - <a href="http://www.ncbi.nlm.nih.gov/pmc/articles/PMC1762641/pdf/ajhg00450-0009.pdf" rel="nofollow">here</a>. The algorithm Rob is describing begins on p. 476, I believe.Liam Revellhttps://www.blogger.com/profile/04314686830842384151noreply@blogger.comtag:blogger.com,1999:blog-8499895524521663926.post-42219698764649393332012-01-24T07:59:02.510-05:002012-01-24T07:59:02.510-05:00Hi,
Your code is impressively fast! But I think t...Hi,<br /><br />Your code is impressively fast! But I think the calculation can be done even faster - using Felsenstein's (1973) algorithm one can avoid creating the variance covariance matrix or having to invert it. Using that algorithm (here called 'fast') I get the following:<br /><br /> lambda logL Time<br />phylosig 0.7114102 -220.1066 0.693<br />fitContinuous 0.7114085 -220.1066 39.770<br />gls 0.7114125 -220.1066 14.666<br />pgls 0.7114119 -220.1066 23.730<br />fast 0.7114101 -220.1066 0.141<br /><br />The differences are exacerbated using larger trees, e.g. here with 1000 tips:<br /><br /> lambda logL Time<br />phylosig 0.7463478 -1109.464 32.126<br />fitContinuous 0.7463439 -1109.464 1146.695<br />gls 0.7463487 -1109.464 380.447<br />pgls 0.7463473 -1109.464 641.631<br />fast 0.7463478 -1109.464 0.801<br /><br />I wonder if the other methods are performing un-necessary computation with respect to forming the variance matrix? <br /><br />RobRob Freckletonnoreply@blogger.comtag:blogger.com,1999:blog-8499895524521663926.post-30253663785068249492012-01-16T18:27:19.105-05:002012-01-16T18:27:19.105-05:00One possible explanation for the faster run time o...One possible explanation for the faster run time of phylosig that I thought of after writing this post is that I use the analytically derived solutions for σ^2 & the root value, conditioned on λ, so that ML optimization is a univariate rather than a multivariate maximization problem. This produces the same parameter estimates & likelihood but should be (theoretically and, evidently, in practice) much quicker.Liam Revellhttps://www.blogger.com/profile/04314686830842384151noreply@blogger.com