Closed orlinst closed 3 years ago
Hi, thanks for reporting this!
This error comes from the function caper::phylo.d
that is used by miss.phylo.d
It happens because there are NAs generated when the function uses caper::contrCalc
(linear model using the crunch algorithm) and it seems to me that this is because some node depths are unknown. @paternogbc do you know why this might happen? Is it maybe related to the way that ape::multi2di solves the multichotomies?
Here is a working example with some randomly generated data and the phylogeny uploaded above:
library(sensiPhy)
library(ape)
tree<-read.tree("~/tree176.nwk")
tree<-di2multi(tree)
data<-data.frame(Diet=sample(c("herbivore","carnivore",NA),replace=T,size=176),
BodySize=sample(1:100,replace=T,size=176))
row.names(data)<-tree$tip.label
DietNaSig<-miss.phylo.d(phy=tree, data, binvar=Diet)
So far I have figured out that if I remove node.labels it works. I guess there is a different way of addressing this too hopefully?
Hi there! I am not 100% sure what really causes this Error besides that it comes from caper::phylo.d function. I will try to dig in caper code but perhaps it would be interesting to contact David Orme (the maintainer of the caper package). cheers
Em ter., 19 de jan. de 2021 às 00:23, Orlin notifications@github.com escreveu:
So far I have figured out that if I remove node.labels it works. I guess there is a different way of addressing this too hopefully?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/paternogbc/sensiPhy/issues/189#issuecomment-762511203, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACJRMOLEFAJEND5BQM4XTMLS2S7GLANCNFSM4WGYUDYA .
Chair of Restoration Ecology | School of Life Sciences Technical University of Munich Emil-Ramann-Str. 6, 85354 Freising, Germany
email: paternogbc@gmail.com Site: https://gustavopaterno.com/ http://www.Raprendiz.wordpress.com Citations: https://scholar.google.com/citations?user=uNxyHMkAAAAJ&hl=pt-BR Research Gate: https://www.researchgate.net/profile/Gustavo_Paterno2 https://www.researchgate.net/profile/Gustavo_Paterno2 Github: https://github.com/paternogbc Skype: gustavopaterno Lattes: http://lattes.cnpq.br/3661227833522004
tree176.zip
function
Which function? e.g.
tree_phylolm
miss.phylo.dProblem
briefly describe your issue here. I am using a nwk tree and a dataset that I have used many time with ape/caper/phytools etc, but when I try to run miss.phylo.d I get the following error: Error in if (round(ransocc[1], digits = 6) != round(physocc[1], digits = 6)) stop("Problem with character change calculation in phylo.d") : missing value where TRUE/FALSE needed
Reproducible example
I figured it does not like the tree somehow, but I cant figure out what is the issue. I have made it ultrametric (as there are some 0 branch lengths) but it still does not work. I am attaching the tree that still needs ultrametricising.