Hello, Chris!
First of all, congratulations on the development of NIMBLE—it’s an outstanding package. Its flexibility for modeling and custom sampler development is remarkable and has been incredibly valuable for my research. For instance, I was able to obtain incredible results using the NUTS sampler within a mixture model while maintaining the standard data augmentation scheme and a discrete sampler—something impossible with other R packages for MCMC.
Regarding the issue, I’ve so far tested it on two Linux machines (both x86_64 with Ubuntu-based distributions). I plan to test it on a Windows 11 machine later today and will report back if the results differ. In the meantime, here are a few new information:
1) Convergence concern: After reading your post, I looked into convergence diagnostics. In one replicate, the first run achieved an n.eff of over 3300, while the second run barely reached 150. The difference is clearly visible in the traceplots—the second run doesn’t converge properly. So the issue appears to impact not just execution time, but also the quality of inference.
Note: For items 2 and 3, I simulated only one chain.
2) Script 2 – I tested the following sequence:
- Estimate (via runMCMC) using dataset y1
- Estimate using dataset y2
- Re-estimate using dataset y1
The results were:
$time1
process real
81ms 81ms
$time2
process real
12.9s 12.9s
$time3
process real
82.5ms 82.5ms
So, reusing runMCMC() with the same dataset—even after a problematic estimation—doesn’t introduce delay. This leads me to wonder whether some dataset-dependent autodiff variables used by NUTS aren’t being properly updated between runs.
3) Script 3 – I also tested the sequence as suggested:
- runMCMC() with dataset y1
- CHMC$run() with dataset y2
- CHMC$run() with dataset y1
Results:
$time1
process real
82.4ms 82.5ms
$time2
process real
12s 12s
$time3
process real
78.1ms 78.1ms
Again, runMCMC() is significantly faster, and CHMC$run() matches its speed only when using the same dataset.
I’ve attached both scripts for clarity and reproducibility.
At this stage of my project, I’m recompiling the model for each replicate in my simulation study, which is extending the timeline by a few weeks.
Thank you again for your time and support—I truly appreciate your help,
Matheus Castro