Installation Instructions


OUT OF DATE --- new JAGS version was released on 5.12.2010. Page will be updated soon!

First, the following should work by itself: sudo apt-get install jags. If not, try the following.

Using the link in Step 6, it may be beneficial to verify that 1.0.3 is the most recent version of JAGS.
If not, one will need to modify Steps 6-8 with the updated version number.

1. Open a terminal window
2. sudo apt-get update (enter password)
3. sudo apt-get install r-mathlib
4. sudo apt-get install lapack3
5. sudo apt-get install lapack3-dev
6. wget http://www-fis.iarc.fr/~martyn/software/jags/JAGS-1.0.3.tar.gz
7. tar xvfz JAGS-1.0.3.tar.gz
8. cd ./JAGS-1.0.3
9. ./configure
10. make
11. sudo make install
12. make clean
13. exit

If you have problem with step 5, do apt-get install refblas3-dev then atlas3-base-dev then run step 4 again

Example

The prompt in jags is ".". To run jags in batch mode, you'll need four text files, one each for the model, data, initial values, and jags script.

Here's an example of the format that should be in your data file:

'y' <- c(9.1, 5.5, 12.3, 9.2, 14.2, 16.8, 22, 18.3, 24.5, 22.7) 
'x' <- c(3, 3, 4, 5, 6, 6, 7, 8, 8, 9) 
'N' <- 10

Here's an example of what could be in the model file:

model {
for(i in 1:N)  {
    y[i] ~ dnorm(mu[i], tau);
    mu[i] <- beta0 + beta1*x[i];
    }

  beta0 ~ dnorm(0, 0.0001);
  beta1 ~ dnorm(0, 0.0001);
  tau ~ dgamma(0.1, 0.1);
}

Here's an example of the initial values file:

".RNG.name" <- "base::Super-Duper"                   /*specifies the random number generator to use. 4 are available*/
".RNG.seed" <- 17                                      /*sets the seed*/
"beta0" <- 3.332
"beta1" <- -1.544
"tau" <- 0.155

Here's an example of the commands you'll use in your script:

cd "filepath"
model in "allergy-bug.txt"
data in "allergy-data.txt"
compile                                              /*one is the default*/
inits in "allergy-inits1.txt"
initialize
update 1000
monitor beta0
monitor beta1
monitor tau
update 1000
coda *                                                /*This writes some files.*/
Topic revision: r5 - 30 Jun 2010, JoAnnAlvarez
 

This site is powered by FoswikiCopyright © 2013-2022 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Vanderbilt Biostatistics Wiki? Send feedback