jagswinbugs

Can JAGS (Just Another Gibbs Sampler) deal with ordinary differential equations?


I searched about the JAGS's manual and one post (here in 2012) about the ordinary differential equation (ode). I was thinking JAGS can because it's similar to WinBUGS (which does it through WBdiff interface). However, if I let JAGS read in my ode code, it cannot even recognize the D(y[...], t) expression.

Can JAGS deal with ode? Maybe I missed a plug-in in JAGS like WBdiff?


Solution

  • While WinBUGS/OpenBUGS/JAGS have almost equivalent syntax/feature sets, there are a few differences between them: one of these is that there is no ODE solver included as part of a standard JAGS installation.

    However, JAGS is extensible using user-specified modules (like the plug-ins you mentioned), which provide new functions/distributions using C++ code that can then be used within JAGS when that module is loaded. It would certainly be possible to implement an ODE this way using e.g. the ODE solvers included in the boost C++ library. To do so you will need the following:

    I can't help you with the former, so this may be a dead-end for you if you have never used C++ before. But there is a tutorial available for how to build a JAGS module: https://pubmed.ncbi.nlm.nih.gov/23959766/ This article shows how to build a standalone module, but if you are happy to accept the limitation of using JAGS from R (as most people do) then it is MUCH easier to build a JAGS module within an R package - you could follow code in the runjags package as an example https://cran.r-project.org/package=runjags

    If you are thinking of trying to do this yourself then I could potentially help with a few pointers along the way. Of course, it is also possible that someone else has already done this, but if so then I am not aware of it.