Closed xuechunxu closed 1 year ago
Hi,
There are a few things you need to pay attention to:
1/ The function multi2di
has the option random = TRUE
by default which may not resolve the root of the tree correctly. You can set random = FALSE
, but you are not sure about the output too. I suggest:
tree <- root(tree, ".....", resolve.root = TRUE)
where you replace "....." by the outgroup label. 2/ You certainly need to do the following transformation:
x[x == "DontKnow"] <- NA
See the explanation in ?ace
about how missing values are treated by this function.
3/ It seems you need to transform the branch lengths of the tree. For instance:
tree2 <- compute.brlen(tree, 1)
This is quite common that non-ultrametric trees fail when input into ace
. You may try different transformations (see ?compute.brlen
and other functions in other packages like geiger or phytools). Then it's up to you to interpret these transformations with respect to your data.
Best,
Emmanuel
Thank you very much, it worked. The bug is caused that the length of some leaves being zero in my phylogenetic tree. Thank you again.
Hi,
I estimated ancestral character states for discretely valued traits. But got the error:
Error in matexpo(Q * EL[i]) : NA/NaN/Inf in foreign function call (arg 1) In addition: Warning messages: 1: In log(comp[-TIPS]) : NaNs produced 2: In ace(x, tree, model = "ER", type = "discrete") : model fit suspicious: gradients apparently non-finite
Here is my command line:
![image](https://user-images.githubusercontent.com/23622076/234539471-0e4abe08-04da-4bf2-8f33-3d7f95d185a3.png)
This is my niche file, these are five niche types![image](https://user-images.githubusercontent.com/23622076/234540225-be0f704c-1b0d-42eb-ac4d-88cf34a7b4ae.png)
The input file: ace.zip
Looking forward to your reply!
Chun Xu