emmanuelparadis / ape

analysis of phylogenetics and evolution
http://ape-package.ird.fr/
GNU General Public License v2.0
52 stars 11 forks source link

corBrownian error #40

Closed robertlennox closed 2 years ago

robertlennox commented 2 years ago

When I run the name.check I get a message "OK" but warning, unknown column "tip.labels".. that is not in my data, so it must be unknown in the tree (but it is the default name)

I wonder if there is maybe an issue with repeated measures, I hadn't considered before but I have multiple measures for the same species..a table below of obs by species (first five).. maybe the pgls assumes one row per species..

species_latin n

1 Acanthocybium solandri 7 2 Acipenser transmontanus 126 3 Albula glossodonta 57 4 Albula vulpes 109 5 Brosme brosme 432 Could the lack of unique species names be throwing it off? My model is gls(time~length, corBrownian(phy=fishPhyTree, form=~species_latin)) as in the tutorial, but still the same error (sample of data below) species_latin time length 1 Cichla ocellaris 15 28.6 2 Cichla ocellaris 10 21.6 3 Cichla ocellaris 5 21 4 Cichla ocellaris 5 25 5 Cichla ocellaris 15 33 6 Cichla ocellaris 15 27.9 7 Cichla ocellaris 5 21 8 Cichla ocellaris 15 31.8 9 Cichla ocellaris 10 27.9 10 Cichla ocellaris 10 27.9 Error in mat[covariate, covariate] : subscript out of bounds
emmanuelparadis commented 2 years ago

Multiple measures for the same species is likely the problem since the form=~species_latin option will match the rows of your data table with the tips of the tree. I suggest you aggregate them.

robertlennox commented 2 years ago

Is there a logical reason why this would have run perfectly fine a few months ago? Any further advice as to whether this could be run in the nlme::lme framework would be appreciated..

emmanuelparadis commented 2 years ago

There is no logical reason why this would run fine now or a few months ago (or last year!) The reason is that if the same label is used in two different data objects (a tree and a data frame in your case), there is no unambiguous way to match them. For instance, you may have a tree with ten tips having the same label "Cichla ocellaris", but which one of them has a length of 28.6? This is the same reason why duplicated labels are not accepted in boot.phylo(), among other functions.