## OpenBUGS

** Category** Intelligent Software>Bayesian Network Systems/Tools

** Abstract** OpenBUGS is the open source version of BUGS.

BUGS (Bayesian inference Using Gibbs Sampling) is computer software that can be used for the 'Bayesian analysis' of complex ‘statistical models’ using Markov chain Monte Carlo (MCMC) methods.

It has been developing and maturing over the years, and is probably best known in its WinBugs incarnations.

The latest version can run on Windows and Linux, as well as from inside the R statistical package.

How BUGS works -- The software creates lots of objects, wires the objects together and then gets the objects to talk to each other.

More formally a dynamic data structure, a 'directed acyclic graph' (DAG), of objects is built to represent the Bayesian model.

This graph is able to exploit conditional independence assumptions to efficiently calculate conditional probabilities. A layer of 'updater objects' is created to sample parameters of the model and copy them into the graph data structure.

Finally a layer of 'monitor objects' can be created to monitor (watch) the values of the sampled parameters and provide summary statistics for them.

How the graph of objects is built - The user writes a description of the Bayesian model in the BUGS language. This model description is also a description of the graph of objects that BUGS should build.

A compiler turns the ‘textual representation’ of the Bayesian model into the graph of objects.

Objects of base class ‘updater’ have a method which is able to decide if objects of that particular class can (and should) act as updaters for a particular parameter in the model based on the functional form of its conditional distribution.

Compilation and inference -- Compilation of the description of a Bayesian model in the BUGS language involves a number of stages.

Firstly, lexical analysis, scanning, is performed to break the stream of characters representing the model into tokens.

Secondly syntactical analysis, parsing, is performed to build a tree representation of the model.

Thirdly the graph of objects is constructed by a 'post order traversal' of the parse tree with objects whose values have been observed marked as data.

Finally conditional independence is used to produce lists of 'graph objects' that when multiplied together calculate conditional distributions.

BUGS uses MCMC simulation algorithms to make an inference. BUGS automatically chooses the inference algorithm.

BUGS is able to match a wide choice of MCMC algorithms, such as single site Gibbs, slice sampling and continuously adapting block Metropolis, to the model parameters that need updating.

Software development -- BUGS is written in the language Component Pascal (CP) using the BlackBox Component Builder from Oberon microsystems. CP is a very modern compiled language with both modular and object orientated features.

The language is highly dynamic with runtime loading and linking of modules. Compiled modules contain 'meta information' that allows the module loader to verify that the loaded module provides the services required by the client.

The BlackBox Component Builder comes with several subsystems of modules which make the development of graphical user interfaces (GUIs) simple.

More unique is the idea of a compound document, an editable text document that is able to contain graphics views. Graphics views can be developed by extending a view class.

Graphics views can be made editable and special purpose drawing tools such as DoodleBUGS can be easily developed.

Metaprogramming -- Metaprogramming is self awareness for software. Software can ask itself questions.

For example does module 'Foo' export an item called 'Bar'? What sort of item is Bar? Can such a thing be done with Bar? More formally one can ask if a particular module is loaded. If the module is loaded one can examine its metadata and then query this metadata.

For example one could ask if a module Foo is loaded and if Not load the module. Then one could ask if module Foo contains a procedure Bar with say No parameters and if so to call (execute) this procedure.

BUGS makes use of metaprogramming in many places.

These uses of metaprogramming fall into two (2) broad groups: program configuration and interfacing.

In the first group is the support for the BUGS language, loading sampling algorithms and loading data reading algorithms.

In the second group is the construction of GUI interfaces, implementing a scripting language and interfacing to R.

Different versions of BUGS --

BUGS: The original, DOS version; WinBUGS: A Windows program, which includes doodles, and lots of things to click; OpenBUGS: The next innovation: an open source version, that includes Windows, Linux and R sub-species;

LinBUGS: OpenBUGS for Linux; BRugs: Bugs for R, comprising OpenBUGS plus some R code to create the R interface; ClassicBUGS: A new DOS version of BUGS.

PKBugs: PKBugs is an efficient and user-friendly interface for specifying complex population pharmacokinetic/pharmacodynamic (PK/PD) models within the widely-used WinBUGS software.

*System Requirements*

Contact manufacturer.

*Manufacturer*

- Thomas Andrew
- Rolf Nevanlinna Institute
- P.O. Box 4
- FIN-00014, University of Helsinki, Finland
- Bob O'Hara
- Dept. of Mathematics and Statistics
- P.O. Box 68
- FIN-00014, University of Helsinki, Finland
- E-mail: openbugs@RNI.Helsinki.FI

** Manufacturer Web Site**
OpenBUGS

** Price** Contact manufacturer.

** G6G Abstract Number** 20356

** G6G Manufacturer Number** 104006