||Study design and data analysis|
|stats main page||
WinBUGS was the successor to BUGS, the first program to perform Bayesian analysis of complex models using Markov chain Monte Carlo (MCMC) methods, and provided access to the functions of BUGS through a Windows interface. The last version of WinBUGS, 1.4.3, was released in August 2007 and works fine with Windows XP. No further updates are planned, and future development will take place in OpenBUGS and JAGS.
A lot of code for WinBUGS is still in use. Books such as Gelman & Hill (2007), Royle & Dorazio (2008), Kéry (2010) and Kéry & Schaub (2011) all provide code designed for WinBUGS, as do a number of papers in ecological journals. Not all of this code works in OpenBUGS or JAGS. Hence users still need to run WinBUGS on post-2007 machines.
The hints below will help you to install WinBUGS on windows Vista/7/8/10, including 64-bit machines.
Do not install WinBUGS in the C:\Program Files folder! WinBUGS tries to write to files in its home folder, which current Windows versions will not allow, generating error messages and warnings.
1. Create a new folder on the C: drive and call it (say) C:\Programs.
2. Download a ZIP file with all the necessary components for WinBUGS here (right-click and select Save Link As... or Save Target As...). If you wish, run a virus check.
3. The ZIP file, WinBUGSinstall.zip, contains a folder called "WinBUGS14". Extract this folder and put it into the C:\Programs folder.
4. To place a shortcut on the desktop, find the Application file WinBUGS14.exe inside the C:\Programs\WinBUGS14 folder, right-click and select Send to > Desktop (create a shortcut).
Note that WinBUGS is not included in Windows Registry and will not appear in "Add or Remove Programs" or "Uninstall or change a program". To remove WinBUGS just delete the WinBUGS14 folder.
To tell R where to find WinBUGS.exe, follow the instructions below to edit (or create) your own .Rprofile file. (Note that dot at the beginning of .Rprofile.) Watch out for a file of type "RPROFILE file" in the My Documents folder and do not delete!
You must have R installed before you do this.
Look inside the C:\Programs\WinBUGS14 folder and you will find an "R Workspace" file with a blue "R" icon called setBugsFolder.Rdata. Double-click on this file to open it and a script will automatically run. You should see a confirmation message in the R Console and your .Rprofile file will be displayed (see screen shot below). You may be asked to navigate to the WinBUGS14 folder. If you try to do this more than once, you will have to edit the .Rprofile file first: follow the instruction in the R Console.
1. Download a ZIP file with the R script here.
2. Extract the script file called "setBugsFolder_script.R".
3. Open R. EITHER drag-and-drop the script file into the R Console window, OR go to File > Source R code... and select the script file. You will be asked to browse to the folder containing the WinBUGS14.exe Application. R will do the rest.
Check this has worked:
Close R and reopen it so that it reads the new .Rprofile file. Then type (or copy/paste from here):
> options("R2WinBUGS.bugs.directory") $R2WinBUGS.bugs.directory NULL
The R2WinBUGS.bugs.directory option is not set until you load R2WinBUGS. Now do:
> library(R2WinBUGS) Loading required package: coda Loading required package: lattice > options("R2WinBUGS.bugs.directory") $R2WinBUGS.bugs.directory  "C:/Programs/WinBUGS14"
If this doesn't work for you, you have other options:
Option A: If you run your code from an R script put the line
Option B: Every time you call the bugs() function, include the argument bugs.directory. For example:
bugs(bugsData, inits=NULL, parameters.to.save="N", ... bugs.directory="C:\\Programs\\WinBUGS14", ...)
Upgrading to Version 1.4.3. and "Student version" or "License expired" messages.
The version of WinBUGS.exe in the ZIP file downloaded from this site is already upgraded to Version 1.4.3 and has the immortality key installed.
If you downloaded elsewhere and have these problems, the simplest solution is to download from here and install again.
Linking WinBUGS's ODC documents. It's nice to be able to open a document by double-clicking on its icon. But if you have MS Office installed, you won't be able to do this with WinBUGS's own ODC files, as MS Office uses the .odc extension for Office Document Connections and tries to open them in Excel. I haven't yet found a way to change this behaviour permanently (Office changes it back next time you run Excel), short of dumping MS Office and using LibreOffice.
Text by Mike Meredith, updated 31 May 2017