MultiBUGS / MultiBUGS

Multi-core BUGS for fast Bayesian inference of large hierarchical models
https://www.multibugs.org
GNU Lesser General Public License v3.0
33 stars 9 forks source link

(Possible Feature Request) Facility for coding your own distributions in Component Pascal for MultiBUGS #56

Open ghahnghahn opened 4 years ago

ghahnghahn commented 4 years ago

Hello - there used to be a guide to coding your own univariate distributions in WBDEV (the old WinBUGS development environment). The URL seems to have gone but here is an archive (https://web.archive.org/web/20141014011916/http://winbugs-development.mrc-bsu.cam.ac.uk/) and here is an archive of some of the old documentation (https://web.archive.org/web/20160222005145fw_/http://winbugs-development.mrc-bsu.cam.ac.uk/files/wbdev_tutorial.pdf) There is an especially to-the-point example PDF called "WBDev_distributions.pdf" which comes part of the WBDEV file but it is encoded and is not easily linked to here. If needed, I could upload it.

We can of course use the "ones trick" or "zeros trick" from the generic sampling distributions help but as mentioned in the WBDEV documentation the compiled versions are faster plus there are several other advantages such as code simplicity, simulation of missing values, etc.

I have done some digging around in OpenBUGS and MultiBUGS and have located the UDev area of OpenBUGS and these carry over to MultiBUGS. I see many new distributions have been added through the ReliaBUGS portion etc. There are also some code listings in Openbugs\Graph\Rsrc\ But I cannot figure out how MultiBUGS would be "informed" of the existence of new compiled distributions. This was previously done in WBDEV by updating \WBDEV\Rsrc\Distributions.odc. There is some good OpenBUGS documentation about adding functions (UDevDocumentation.pdf).

Anyway, I thought I would mention this as a possible (low-priority) feature request. I have some WBDEV code I would like to port over as MultiBUGS is a step up from WinBUGS. Thanks.

rjbgoudie commented 4 years ago

Hi, sorry for the slow reply. See below from @helsinkiant, who is happy to help with any problems.

There is some support in MultiBUGS for adding new distributions to the BUGS language.

There is a module GraphUnivariateT which is a template that can be extended when writing new univariate stochastic nodes. An example is given in GraphUnivariatetemp1 which gives a clumsy implementation of the normal but more importantly what the user has to add to the template. The link between the module and the name in the BUGS language of a distribution is given in a separate module usually called XxxExternal. Most of the standard MultiBUGS distributions are linked in BugsExternal but the reliability distributions are in module ReliabilityExternal.