##### Overview...

BUGS is a software package for performing **B**ayesian inference **U**sing **G**ibbs **S**ampling. The user specifies a statistical model, of (almost) arbitrary complexity, by simply stating the relationships between related variables. The software includes an ‘expert system’, which determines an appropriate MCMC (Markov chain Monte Carlo) scheme (based on the Gibbs sampler) for analysing the specified model. The user then controls the execution of the scheme and is free to choose from a wide range of output types.

##### Versions...

There are two main versions of BUGS, namely WinBUGS and OpenBUGS. This site is dedicated to OpenBUGS, an open-source version of the package, on which all future development work will be focused. OpenBUGS, therefore, represents the future of the BUGS project. WinBUGS, on the other hand, is an established and stable, stand-alone version of the software, which will remain available but not further developed. The latest versions of OpenBUGS (from v3.0.7 onwards) have been designed to be at least as efficient and reliable as WinBUGS over a wide range of test applications. Please see here for more information on WinBUGS. OpenBUGS runs on x86 machines with MS Windows, Unix/Linux or Macintosh (using Wine).

Note that software exists to run OpenBUGS (and analyse its output) from within both R and SAS, amongst others.

For additional details on the differences between OpenBUGS and WinBUGS see the OpenVsWin manual page.

##### How it works...

The specified model belongs to a class known as *Directed Acyclic Graphs* (DAGs), for which there exists an elegant underlying mathematical theory. This allows us to break down the analysis of arbitrarily large and complex structures into a sequence of relatively simple computations. BUGS includes a range of algorithms that its expert system can assign to each such computational task.

One of the main differences between OpenBUGS and WinBUGS is the way in which the expert system makes its decisions. WinBUGS defines one algorithm for each possible computation type whereas there is no limit to the number of algorithms that OpenBUGS can make use of, making for much greater flexibility and extensibility.

##### History...

The BUGS project grew out of work in artificial intelligence in the early 1980s. Key developments included: exact means of propagating uncertainty in graphical structures; understanding that simulation methods could be used for inference; and recognising that object-oriented programming could be exploited to generalise the simulation algorithm. A start was made on the BUGS program in 1989 with the appointment of chief programmer Andrew Thomas, working under David Spiegelhalter, to the MRC Biostatistics Unit in Cambridge. Coincidentally, at the same time, the classic MCMC work of Gelfand and Smith [1] was being carried out 80 miles away in Nottingham, but entirely independently and from a rather different starting point.

Initially, BUGS only used fairly specialised algorithms. In 1996, however, the project moved to Imperial College, London (headed by Nicky Best, who had already been involved for some years in Cambridge) and work began on expanding the software’s capabilities. In particular, Jon Wakefield and Dave Lunn joined the project at this stage to work on implementing non-linear models, and development of a stand-alone Windows version of the software gained momentum. In subsequent years, a number of other challenging model types were tackled, including spatial models, dynamic models (involving differential equations) and variable-dimension models (fitted using reversible jump MCMC).

In 2004, Andrew Thomas moved to Helsinki to begin work on OpenBUGS, while Dave Lunn and Nicky Best remained at Imperial, continuing maintenance and development of WinBUGS. Thus the two packages diverged somewhat, each with their own advanced features unavailable in the other. However, now that OpenBUGS has progressed from being somewhat experimental to a stable and reliable package, we are now focussing all development efforts on it.

Interested readers may like to take a look at Lunn *et al*. [2] for further details.

##### Future...

Improvements currently under development are listed here.

[1] Gelfand, A. E. and Smith, A. F. M. (1990) Sampling-based approaches to calculating marginal densities, Journal of the American Statistical Association **85**: 398--409

[2] Lunn, D., Spiegelhalter, D., Thomas, A. and Best, N. (2009) The BUGS project: Evolution, critique and future directions (with discussion), *Statistics in Medicine* **28**: 3049--3082.