Written and maintained by CASRAI Editorial Board
Published
On this page
WinBUGS is an interactive Windows program for Bayesian analysis of complex statistical models using Markov chain Monte Carlo (MCMC) techniques. It was developed by the BUGS project, which began at the Medical Research Council Biostatistics Unit in Cambridge in 1989, and its own manual describes it as an interactive Windows version of the BUGS program. You describe a model in the BUGS language or as a graphical Doodle, load data and initial values, run the sampler, then monitor and summarise the sampled nodes. This guide covers what the software is, the exact order of its dialog boxes, its documented limits, and how it relates to OpenBUGS and JAGS.
What WinBUGS is
BUGS stands for Bayesian inference Using Gibbs Sampling. According to the WinBUGS User Manual, Version 1.4 (Spiegelhalter, Thomas, Best and Lunn, January 2003), the program lets a researcher specify a model, supply data, and obtain posterior samples without writing the sampler by hand. Models are written in a slightly amended version of the BUGS language, or drawn as a graphical model called a Doodle in the DoodleBUGS editor. The manual states that the BUGS language is more flexible than Doodles, and that a model written as text cannot be translated back into a Doodle.
The program is menu driven. The menus named in the manual are Model, Inference, Info, Options and Script, and the Script menu provides a batch mode for running the same steps from a script rather than by clicking. Two ideas from the broader MCMC guide matter before you start: the chain has to be run long enough to reach its target distribution, and the stored samples are only usable once you have checked that it did. WinBUGS provides the tools to record and inspect samples; it does not make that judgement for you.
Who made it and what its status is
The history comes from the project’s own retrospective, Lunn, Spiegelhalter, Thomas and Best (2009), “The BUGS project: Evolution, critique and future directions” in Statistics in Medicine. The authors report that in the mid-1990s the project decided to build a stand-alone interactive Windows version, written in Component Pascal inside the BlackBox Component Builder. In 2004 Andrew Thomas began OpenBUGS, an open-source version, at the University of Helsinki, with the aims of separating the computational core from the user interface, supporting more than one platform, and allowing experimental versions.
The same paper positions WinBUGS as the established, stable version. It says OpenBUGS represents the future of the project, while WinBUGS will always remain available as a stable version for routine use. The authors also note that WinBUGS continued to be developed at Imperial College for specialised areas such as genetic epidemiology, pharmacokinetics and reversible jump methods. In other words, the project’s own account treats WinBUGS as a stable reference implementation rather than the platform for new features, and that is the right way to read it when you meet it in a course, a protocol or an older published analysis.
How a WinBUGS run is organised
The manual presents the workflow as a fixed sequence of tools. The data table below lists each tool, the control you press and the message or output the manual describes. The manual describes the buttons in this order, with the number of chains set between checking and compiling.
- Write the model. Enter BUGS code in a document window, or build a Doodle. Open the Specification Tool from the Model menu.
- Check, then load data. The check model button parses the code and reports a syntax error on the status line at the bottom left. Data can be supplied in S-Plus list format or in rectangular format, and the status line confirms when the data are loaded.
- Set the number of chains. The default is one chain. The manual says to set the number after the model has been checked and before it is compiled. Several chains are what let you compare runs for convergence later.
- Compile. On success the status line reads model compiled. WinBUGS automatically creates a deviance node, defined as minus twice the log-likelihood.
- Initialise. Use load inits to supply starting values, with NA for elements that are known or fixed, or gen inits to have WinBUGS sample starting values from the prior or an approximation. The manual warns that generated values can be extreme when priors are very vague.
- Run the sampler. In the Update Tool, set updates, refresh and thin, then press update. The manual’s own example: with updates set to 100 and thin set to 10, 1000 iterations are run and 100 are stored.
- Record and summarise. Open the Sample Monitor Tool from Inference, then Samples. Type a node name (an asterisk means all monitored nodes), set beg, end and thin, and press set to start recording. The tool then offers history, density, auto cor (autocorrelation to lag 50), stats and coda, which writes CODA output files for analysis in other software.
Thinning is set in two places
The Update Tool and the Sample Monitor Tool each have a thin field, and they do different jobs. The Update Tool’s thin controls how many iterations are run per stored update, as in the 1000 run and 100 stored example above. The Sample Monitor’s thin controls which stored values are kept for a particular node. Keeping the two straight avoids the common surprise of finding fewer samples than expected when you request statistics.
Comparing models with the DIC tool
The DIC Tool has set, clear and DIC controls. For the monitored deviance, it reports Dbar (the posterior mean deviance), Dhat (the deviance at the posterior means), pD = Dbar minus Dhat, and DIC = Dbar plus pD. The manual states that the model with the smallest DIC is estimated to be the one that would best predict a replicate data set of the same structure. It also cautions that DIC assumes the posterior mean is a good estimate of the stochastic parameters, which can fail when posteriors are extremely skewed or bimodal. Treat a DIC difference as one piece of evidence, not a verdict; a worked treatment of prior choice and sensitivity is in the guide to prior distributions.
Strengths and limits
The documented strengths are practical. The model is written in a declarative language rather than as sampler code, a graphical route exists for people who prefer to draw the model, and one interface covers specification, sampling, monitoring and DIC. The Script menu supports batch runs, and the 2009 paper says other interfaces were built on the BUGS core, including the R interface BRugs and interfaces for SAS, Stata and Excel.
The limits are stated just as plainly by the authors. The manual warns users to be extremely careful if using the program for serious statistical analysis, and includes the line “Beware: MCMC sampling can be dangerous!” It does not teach Bayesian reasoning, the choice of priors or the monitoring of convergence, and recommends using the program alongside a course. It also states that because WinBUGS simulates each node in turn, convergence can be very slow for models with strongly related parameters, such as hidden-Markov and other time-series structures. The 2003 manual describes a registration key: an educational version could run only the example data sets, and models of fewer than 100 nodes on your own data were allowed until a key was obtained. That describes the manual-era licensing arrangement, so check the terms of whichever copy you hold rather than assuming them.
A useful rule for reviewers: if a paper reports WinBUGS output, look for how many chains were run, how convergence was judged, and what priors were used. Those are the three things the software leaves to the analyst. For models with grouped data, the Bayesian hierarchical models guide shows the structure that BUGS-language examples most often implement, and the guide on summarising a posterior distribution explains how to report what the monitor tool’s stats and density outputs give you.
Alternatives: OpenBUGS and JAGS
Two descendants and relatives of WinBUGS use the same BUGS language idea. The table below states only what the 2009 paper and the JAGS project page say.
| Program | What the sources state | Source |
|---|---|---|
| WinBUGS | Windows program with a graphical interface; the established, stable version; kept at Imperial for specialised developments; updates each node using one method per classified full conditional | Manual (2003); Lunn et al. (2009) |
| OpenBUGS | Open-source version begun in 2004 by Andrew Thomas; separates the core from the interface so other front ends (such as BRugs for R) can be built; described as the future of the project; works through a list of updating methods in order of increasing generality | Lunn et al. (2009) |
| JAGS | “Just Another Gibbs Sampler”: a cross-platform engine for the BUGS language, extensible with user-written functions, distributions and samplers; licensed under the GNU General Public License version 2; latest release listed is 4.3.2 (4 March 2023) | JAGS project page; Lunn et al. (2009) |
The practical consequence is that a BUGS-language model written for WinBUGS is the right starting point for understanding any of the three, but you should confirm which program a published analysis used before trying to reproduce it, because the updating methods differ. For analyses that use newer samplers, the CASRAI guides on NumPyro and Bayesian regression cover Python and regression-focused workflows.
Where to find help
The most complete first-party description of the interface is the manual cited below, which includes a tutorial for new users: step through the tutorial, try the worked examples in Examples Volumes 1 and 2, then edit the BUGS code of an example to fit your own problem. The manual is explicit that it is a reference for the program, not a statistics course.
Sources
- WinBUGS User Manual, Version 1.4, Spiegelhalter, Thomas, Best and Lunn, MRC Biostatistics Unit and Imperial College School of Medicine, January 2003. Read 2026-11-18.
- The BUGS project: Evolution, critique and future directions, Lunn, Spiegelhalter, Thomas and Best, Statistics in Medicine, 2009 (DOI 10.1002/sim.3680). Read 2026-11-18.
- Full-text copy of the 2009 paper hosted by INRAE AppliBUGS. Read 2026-11-18.
- JAGS: Just Another Gibbs Sampler, project page. Read 2026-11-18.
Data: WinBUGS 1.4 workflow tools, controls and documented outputs
Compiled from the WinBUGS User Manual, Version 1.4 (January 2003): each tool in the order a model run uses it, the control involved and the message or output the manual documents.
Period covered: 2003.
| Step | Tool or menu | Control | Documented message or output |
|---|---|---|---|
| 1 | Specification Tool | check model | Syntax errors shown on the status line at bottom left |
| 2 | Specification Tool | load data | Status line reports Data Loaded; S-Plus list or rectangular format |
| 3 | Specification Tool | num of chains | Default one chain; set after check and before compile |
| 4 | Specification Tool | compile | Status line reports model compiled; a deviance node (-2 x log-likelihood) is created automatically |
| 5 | Specification Tool | load inits / gen inits | Status line reports initial values loaded or generated: model initialized; NA for known elements |
| 6 | Update Tool | updates, refresh, thin, update | updates 100 with thin 10 runs 1000 iterations and stores 100 |
| 7 | Sample Monitor Tool (Inference > Samples) | node, beg, end, thin, set | Records samples; then history, density, auto cor (to lag 50), stats, coda |
| 8 | DIC Tool | set, clear, DIC | Dbar, Dhat, pD = Dbar - Dhat, DIC = Dbar + pD; smallest DIC estimated best predictor |
Sources
- WinBUGS User Manual, Version 1.4 (accessed 2026-11-18)
Compiled by CASRAI from the sources above. Free to reuse under CC BY 4.0 with attribution.







