liamrevell / phytools

GNU General Public License v3.0
198 stars 56 forks source link

Error in matexpo(Q * EL[i]) : NA/NaN/Inf in foreign function call (arg 1) #132

Closed xuechunxu closed 1 year ago

xuechunxu commented 1 year ago

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 image

This is my niche file, these are five niche types image

Looking forward to your reply!

Chun Xu

liamrevell commented 1 year ago

ace is not a phytools function -- it's a function of the ape package by Emmanuel Paradis; however, it is possible to do marginal ancestral state reconstruction using phytools and that's what I'd probably recommend. In that case, you workflow would look roughly as follows:

fitER<-fitMk(tree,x,model="ER")
marginal_ER<-ancr(fitER)

Please try that & let me know what you discover.

xuechunxu commented 1 year ago

Thanks for your reply.

I ran the command, but got the error: marginal_ER<-ancr(fitER) Error in ancr(fitER) : could not find function "ancr" image image

Is my phytools need to be updated? This is my phytools version: image

Thank you again!

Chun Xu

liamrevell commented 1 year ago

Yes, you should install the remotes package from CRAN and then run

remotes::install_github("liamrevell/phytools")

to update phytools from GitHub.

liamrevell commented 1 year ago

(Although I see some problem with your data based on the output from fitMk so you try to get that sorted out first.)

xuechunxu commented 1 year ago

Thanks for your reply.

I was so confused about the error. Is there a problem with my input file? Could you check it for me? Attach please find the tree and niche annotation.

phytools.zip

Thank you very much.

Chun Xu 发件人: Liam J. @.> 发送时间: 2023年4月27日 10:13 收件人: @.> 抄送: chunxu @.>; @.> 主题: Re: [liamrevell/phytools] Error in matexpo(Q * EL[i]) : NA/NaN/Inf in foreign function call (arg 1) (Issue #132)

(Although I see some problem with your data based on the output from fitMk so you try to get that sorted out first.)

― Reply to this email directly, view it on GitHubhttps://github.com/liamrevell/phytools/issues/132#issuecomment-1524469195, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFUHDPDE5D6GYWPAB3DM6ATXDHI4BANCNFSM6AAAAAAXMGBIFA. You are receiving this because you authored the thread.Message ID: @.***>