revbayes / revbayes

Bayesian Phylogenetic Inference Using Graphical Models and an Interactive Model-Specification Language
http://revbayes.com
GNU General Public License v3.0
56 stars 25 forks source link

[BUG] `dnUPP` causing MCMC to fail #499

Open davidcerny opened 2 months ago

davidcerny commented 2 months ago

Describe the bug Because of the "stochaministic" nature of dnUPP() (the uniform partitioning distribution), changes in parameter values are not correctly propagated through the model DAG. This results in analyses that either run seemingly fine but produce invalid results, or crash when RevBayes is compiled with the DEBUG_MCMC flag. With a sufficiently complex model, the distribution can cause MCMC to fail for seemingly unrelated reasons even when this flag is not enabled; see #293 for an example.

To reproduce Run this script. (One absolute path has to be changed; the bears_cytb.nex file is the one from our test suite and dating tutorials). This is a heavily stripped down version of the script from #293. When I run it after enabling DEBUG_MCMC, I get:

   Error:   Issue in 'UPP-Allocation' on 'branch_rates[18]' after move because posterior of -8152.37 and -8149.6/-8149.6. The move was rejected.
   Error:   Problem processing line 123 in file "/Users/David/Downloads/dnUPP_test.Rev"

Expected behavior Reversible-jump MCMC analyses should be able to employ dnUPP without crashing.

Computer info macOS 14.5 (Sonoma), ARM64 architecture, RevBayes 1.2.5-preview, latest version of the development branch (c46173f).

Additional context This bug may have affected papers published by @wf8 and @dpaluh:

Corresponding Rev scripts:

bjoelle commented 2 months ago

is this fixed by PR #407 ?

bredelings commented 2 months ago

No, it isn't.

bredelings commented 2 months ago

If I remember correctly, the problem is that somehow changing the parameters does not propagate all the way down the likelihood. I was trying to follow this in the debugger and tracked the propagation part way down but didn't quite find the point where the propagation quits early.

I think the PR helped, but was not quite sufficient.