nimbleMCMC

21 views
Skip to first unread message

Michael Schaub

unread,
Dec 2, 2025, 11:33:25 AM (12 days ago) Dec 2
to nimble...@googlegroups.com
Dear all,

I encountered a strange behaviour of nimbleMCMC after I have changed in a model the specification of a parameter. Initially the parameter was constant over time, while now I apply a linear model with an intercept and a trend over time. When I fit this model using nimbleMCMC, the model gets stuck at the stage 'Checking model calculations'. However, when I fit the model in steps, i.e. using nimbleModel --> compileNImble --> configureMCMC --> buildMCMC --> compileNimble --> runMCMC, the model runs without problems. When the parameter was constant over time, the model also runs without problem when nimbleMCMC is used. Any idea what could be the problem?

Thanks, and kind regards

Michael

Perry de Valpine

unread,
Dec 2, 2025, 1:14:14 PM (12 days ago) Dec 2
to Michael Schaub, nimble...@googlegroups.com
Hi Michael,
Thanks for the question. That does sound unexpected. The two pathways should go through the same steps (unless for example you have manually provided different `check` arguments to one or the other, or provided somehow different model, data, constants, and/or inits). One easy mistake is that inits must be a list for `nimbleModel` but can be a function for `nimbleMCMC`. (In fact, we are putting an error-check for that in the upcoming release.) Is it easy to provide a reproducible example (off-list if you prefer)?
Perry

--
You received this message because you are subscribed to the Google Groups "nimble-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nimble-users...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/nimble-users/CALmJkiGYxty%3Da1iiKC5F%2BuWpt7kiwQ7-Qf7ARpWPJUSOhZE0vw%40mail.gmail.com.

Daniel Turek

unread,
Dec 5, 2025, 11:03:49 AM (9 days ago) Dec 5
to nimble...@googlegroups.com, Perry de Valpine, Michael Schaub
I was able to take a look at Michael's code (shared off list).  When the model and MCMC were being executed in individuals steps, as in the workflow below:

nimbleModel --> compileNImble --> configureMCMC --> buildMCMC --> compileNimble --> runMCMC

The argument "useConjugacy = FALSE" was being provided to configureMCMC, as:

configureMCMC(model, useConjugacy = FALSE)

The "useConjugacy = FALSE" argument prevents all conjugacy checking.  In some model structures, this conjugacy checking can enter into deep recursive dives into the model structure.  However, since conjugacy checking was disabled, this didn't cause a problem.

When executing the entire workflow using nimbleMCMC, first the model is successfully built, which concludes with the final step of "Checking model calculations".  After the model is built, there is a call to configureMCMC() - which when called from nimbleMCMC, *does* include the conjugacy checking.  This checking was entering into a nearly-endless recursive expansion, which was taking basically forever.

When using the nimbleMCMC() workflow, there actually *is no* option for useConjguacy = FALSE from a call to nimbleMCMC - which is something we should perhaps address, but that's for another conversation.  But at present, in order to prevent conjugacy checking, users should use the individual workflow "steps", as shown above, and include the argument "useConjugacy = FALSE" in the call to configureMCMC.

Cheers,
Daniel



Reply all
Reply to author
Forward
0 new messages