Friday, April 1, 2011

Bug fix in optim.phylo.ls()

I just fixed a bug in optim.phylo.ls() - my simple ("for fun") function for least squares phylogeny estimation. Basically, there was an error in the internal function ls.tree(), which was causing the distance matrix to be improperly sorted. In particular, I originally had:

colD<-D[lower.tri(D[tree$tip.label,tree$tip.label])]

which used the index from a sorted matrix to columnarize D - but never actually sorted D by the $tip.label order! Oops. I have now changed this to:

D<-D[tree$tip.label,tree$tip.label]
colD<-D[lower.tri(D)]


and the problem is solved. See updated code here.

No comments:

Post a Comment