You are here:
Vanderbilt Biostatistics Wiki
>
Main Web
>
CE
>
BayesianDataAnalysisWithOpenBUGSAndBRugs
>
JAGSInstallExample
(30 Jun 2010,
JoAnnAlvarez
)
(raw view)
E
dit
A
ttach
---+++ 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. <br> If not, one will need to modify Steps 6-8 with the updated version number._ 1. Open a terminal window <br> 2. sudo apt-get update (enter password) <br> 3. sudo apt-get install r-mathlib <br> 4. sudo apt-get install lapack3 <br> 5. sudo apt-get install lapack3-dev <br> 6. wget http://www-fis.iarc.fr/~martyn/software/jags/JAGS-1.0.3.tar.gz <br> 7. tar xvfz JAGS-1.0.3.tar.gz <br> 8. cd ./JAGS-1.0.3 <br> 9. ./configure <br> 10. make <br> 11. sudo make install <br> 12. make clean <br> 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: <verbatim> '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 </verbatim> Here's an example of what could be in the model file: <verbatim> 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); } </verbatim> Here's an example of the initial values file: <verbatim> ".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 </verbatim> Here's an example of the commands you'll use in your script: <verbatim> 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.*/ </verbatim>
E
dit
|
A
ttach
|
P
rint version
|
H
istory
: r5
<
r4
<
r3
<
r2
|
B
acklinks
|
V
iew topic
|
Edit
w
iki text
|
M
ore topic actions
Topic revision: r5 - 30 Jun 2010,
JoAnnAlvarez
Main
Department Home Page
Biostatistics Graduate Program
Vanderbilt University Medical Center
Main Web
Main Web Home
Search
Recent Changes
Changes
Topic list
Biostatistics Webs
Archive
Main
Sandbox
System
Register
|
Log In
Copyright © 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