Here are the instructions on how to install the statistics package R and the simulation package BUGS. The original BUGS (Bayesian inference Using Gibbs Sampling) has now developed to the versions WinBUGS, OpenBUGS and the closely related JAGS. (I recommend using OpenBUGS.) I'll show you how to install in Linux and Windows, having no experience with Macintosh. In some appendices, I'll give some information for those who are adventurous. The R Journal mentioned below is a free, refereed journal.
If you don't have Ubuntu but are considering it, please have a look at the distribution's home page and this excellent guide. Ubuntu uses the desktop environment Gnome. If you prefer KDE you can instead use Kubuntu. (You can even have both on the same partition.)
If you don't have Fedora but are considering it, please have a look at the distribution's home page and this excellent guide.
Thr newest versions have changed the default desktop environment, Ubuntu 11.04 to Unity, Fedora 15 to Gnome 3. If you like the good old Gnome 2 environment I can recommend Linux Mint. The commands below for Ubuntu also applies for Linux Mint. For Ubuntu users, be sure to have Universe included in your repositories, check it in /etc/apt/sources.list.
Install R using the command
Ubuntu: sudo apt-get install r-base r-base-html r-doc-html
Fedora: sudo yum install R
If you are using Emacs, "Emacs Speaks Statistics" and info to R can be recommended:
Ubuntu: sudo apt-get install ess r-doc-info
Fedora: sudo yum install emacs-ess
In the file .emacs there must then be the line
(require 'ess-site)
You start R with the command R and leave R with q(). (Nowadays there are other ways to leave the system nicely, too.) In Emacs the command is M-x R.
On CRAN, more precisely from the download page, fetch the package R-2.13.1-win32.exe. (There is a 64-bit version, but even with a 64-bit computer the 32-bit version is probably the right one.) Put it into your Downloads folder. Clicking the icon, you can ignore the security warning. You are asked about language, destination, components, startup options, and more. If you choose the proposed defaults, you now have an icon for R on your desktop.
R has 3207 packages at the moment of writing! Some are installed by default, which you can check within R with the command search(). More come with the installation, which you can check with the command library().
To analyse output from WinBUGS with R, you need to install the package coda. In Ubuntu, you can simply use the command
sudo apt-get install r-cran-coda
Windows and Fedora users can do the following (in Fedora as superuser):
Within R, install the package with the command
install.packages("coda")
You are asked about repository, "Denmark" being the obvious choice. In Vista the package is stored in a personal folder.
Other packages can be installed from CRAN in a similar way (some can be installed with apt-get in Ubuntu) but if this fails, try to download the package and install it from the command line (outside R) with the command R CMD INSTALL.
For making a graphical superstructure to BUGS, the developers long ago made the unhappy decision the use the Oberon BlackBox software which only works in Windows. To run the Windows package OpenBUGS in Linux, you need installation of the compatibility layer Wine. (OpenBUGS has a Linux version without graphics and badly documentated, but I don't think it is worthwhile.)
Ubuntu: sudo apt-get install wine1.3
Fedora: sudo yum install wine3
As ordinary user you run the command winecfg. A menu appears, but it's all right to use the default setup with Windows XP. Hereby is made a C drive under ~/.wine/drive_c emulating Windows, but also a Z drive from which you have access to your Linux files.
Make a directory, e.g. /opt/OpenBUGS/. Go to OpenBUGS, fetch OpenBUGSsetup.exe after som clicking in the Downloads section and put it into your new directory. The run wine Z:/opt/OpenBUGS/OpenBUGSsetup.exe Ignore the many lines with fixme in the Installation Wizard, choose Z:/opt/OpenBUGS for installation. Then you can run OpenBUGS with the command
wine Z:/opt/OpenBUGS/OpenBUGS.exe
If you don't want to write this every time, you can make an alias, e.g. in your .bashrc file you can insert the line
alias openbugs='wine Z:/opt/OpenBUGS/OpenBUGS.exe'.
NB! Unfortunately there seems to be a problem with the documentation. The three tabs Examples, Manuals and Help in the OpenBUGS window do not work properly. They have worked before and will probably do so again with a new version of Wine. But don't despair! From the file /opt/OpenBUGS/Manuals/Introduction.html you can click your way to all the information in a browser. And this is perhaps even better!
Go to the download section of OpenBUGS and fetch OpenBUGS321setup.exe. Put it into your Downloads folder from which OpenBUGS can be automatically installed. You can choose to have a link on your desktop.
It is not necessary for this course to have the newest version of R, but if you like to, in Windows regularly check for new versions in CRAN.
In Linux you can have automatic updating by enlarging your package repository. In Ubuntu, add the following line in /etc/apt/sources.list:
deb http://cran.r-project.org/bin/linux/ubuntu natty/
The paranoid can install the security checker:
gpg --keyserver subkeys.pgp.net --recv-key E2A11821
gpg -a --export E2A11821 | sudo apt-key add -
Then run
sudo apt-get update && sudo apt-get upgrade
For Fedora, look in CRAN. (Perhaps more detail will come here.)
OpenBugs is free as in freedom. WinBUGS is as least free as in free beer (gratis). (Search "Richard Stallman" for more information.)
Installing it is a bit more cumbersome. (For Linux, you need the Wine wrapping as above.) Go to the download page and find Quick Start. I recommend downloading the zip version winbugs14.zip for all systems. Unzip it into e.g. /opt/ for Linux, C:\Program Files in Windows XP, for Vista find a place where you have access. Fetch the (permanent) registration key WinBUGS14_immortality_key.txt and the patch for Version 1.4.3 WinBUGS14_cumulative_patch_No3_06_08_07_RELEASE.txt. Put both files into the directory WinBUGS14 made by the unzip. Start winbugs.exe (for Linux as superuser, see above), use File/Open.. for both, mark them in turn, use Tools/Decode, and click Decode All.
I Windows you may prefer to make a link from the desktop to winbugs.exe.
Except for the graphical envirenment, JAGS (Just Another Gibbs Sampler) has almost the same functionality as WinBUGS, much like a modern version of the pristine BUGS. For people using the command line for file management in Linux it is arguably even better.
Before Version 2.0, it was necessary to install it from the source code which was forbidding for most Windows users. Now the installation is easy for Windows and Mac. Go to Martyn Plummer's home page for JAGS which has a link to SourceForge. Don't use the icon unless you plan to install from the source code. Instead click View all files and fetch JAGS-3.1.0-1-win32.exe. Remember to fetch the documentation as well. But you need to use the command line! I just mention here that the command for leaving JAGS is exit.
Some Linux users will prefer to install it from the source code as before, but you could also use Wine in a similar way as for OpenBUGS. In Ubuntu, you can install it with
sudo apt-get install jags
but you won't get the newest version.