Brook, within the past year or so we added a system for monitoring and recording "derived quantities" during an MCMC run. There are pre-written mechanisms for monitoring:
- the cumulative mean (and/or variance) of any specified model nodes
- the sum of the posterior (log) probability of the entire model, or of arbitrary sets of nodes
- one can also write their own "derived quantity" nimbleFunction, for recording any quantity you might want
So, using the pre-written option for posterior (log) probabilities is what you're looking for. Instead of describing all the syntax here, I'll point you to some documentation, which should explain everything:
Also documented in the Nimble User Manual:
After you set up the derived quantities you want (when configuring the MCMC), the recorded values will be available in the object returned from runMCMC().
Let me know if anything doesn't make sense, or you have additional questions!
Cheers,
Daniel