BCM-Ch03.1: Inferring a Rate
BCM-Ch03.1: Inferring a Rate
BCM-Ch03.1: OpenBUGS-Code for "Inferring a Rate"
Here we represent the OpenBugs-Code and -Output. The WinBUGS-Code was taken from Lee & Wagenmakers (Bayesian Cognitive Modeling, 2013, Ch.03.1 "Inferring a Rate", p.37) and run most unchanged in OpenBUGS.
The "Inferring a Rate" problem was embedded in a "Do People believe in Santa Claus ?" scenario. The OpenBUGS code was embedded in R an can be found here.
BCM-Ch03.1: CHURCH-Code for "Inferring a Rate"
BUGS contains an abstract simple functional modelling language with restricted expressiveness (e.g.: an IF and recursivion is lacking). Furthermore the sampling process is rather opaque to the user. So BUGS appears to be a 'black box' to the modeler. We believe that our modeling approach by coding low level functions in CHURCH is more transparent. Besides the random number generators, the density and the histogram plots each programming construct we used is pure functional Scheme. So it is easy to translate the CHURCH-programs to any functional programming language with similar attributes (random number generators, basic graphic routines).
Furthermore we study how far we could go when the sampling process is restricted to rejection sampling.
The WinBUGS-code from Lee & Wagenmakers is translated by us to a functional CHURCH program. The generative model is contained in the CHURCH function "take-a-sample". This code should be equivalent to the model{...}-part of OpenBUGS. The number of samples taken was set to 20000 in this run. This number could in principle be increased to get a better precision of estimates. The sampling method used is the simple-to-understand 'forward sampling'. The screen-shot presented was generated by using the PlaySpace environment of WebCHURCH.