I just posted a new version of phyl.cca (my function for phylogenetic canonical correlation analysis) that addresses the following error, which initially seemed very alarming:
Error in ccs > 0 : invalid comparison with complex values
It turns out that part spectral decomposition (eigenanalysis) can result in very slightly negative eigenvalues, which result in complex numbers during some steps of the calculations of CCA. In later steps, the imaginary parts go to zero - but R keeps the class of a number as "complex" even if the imaginary part is zero.
To fix this, I merely check to see if all imaginary parts of the canonical correlations are zero, and (if so) set the canonical correlation to the real part of the number only:
This seems to have solved the problems.
This update is also in a new phytools build (phytools 0.3-11) which can be installed from source.
No comments:
Post a Comment
Note: due to the very large amount of spam, all comments are now automatically submitted for moderation.