Linbugs ( aka Openbugs or Winbugs)

From HPC

(Difference between revisions)
Jump to: navigation, search
Aitsswhi (Talk | contribs)
(New page: You can run your Winbugs\Openbugs work on the HPC cluster using Linbugs which is the classic interface version and can be used from a terminal. =Opening Linbugs= linbugs =Issues and Pr...)
Newer edit →

Revision as of 09:47, 7 May 2009

You can run your Winbugs\Openbugs work on the HPC cluster using Linbugs which is the classic interface version and can be used from a terminal.

Contents

Opening Linbugs

linbugs

Issues and Problems

The only issue know with the linux version is the command modelSaveLog('log.txt') cause the an error. This command should not be used, you will find that a file called run.out is create automatically which is the same as the log.

Example

Create the following files

data.txt

list(
  t = c( 9.43000E+01, 1.57000E+01, 6.29000E+01, 1.26000E+02, 
         5.24000E+00, 3.14000E+01, 1.05000E+00, 1.05000E+00, 
         2.10000E+00, 1.05000E+01 ), 
  x = c(  5, 1, 5, 14, 3, 19, 1, 1, 4, 22 ), 
  N = 10
)

model.txt

	model

{ for (i in 1 : N) { theta[i] ~ dgamma(alpha, beta) lambda[i] <- theta[i] * t[i] x[i] ~ dpois(lambda[i]) } alpha ~ dexp(1) beta ~ dgamma(0.1, 1.0) }

init1.txt

list(
  alpha = 1.00000E+00,
  beta = 1.00000E+00
)

Now open linbugs

linbugs

and enter the following commands (note, this script could be saved as a text file and run via the command 'linbugs < script.txt')

modelCheck('model.txt')
modelData('data.txt')
modelCompile(1)
modelInits('init1.txt', 1)
modelGenInits()
samplesBeg(501)
modelSetRN(314159)
modelUpdate(500, 1)
samplesSet(theta)
samplesSet(alpha)
samplesSet(beta)
samplesSet(deviance)
modelUpdate(500, 1)
samplesStats('*')
samplesCoda('*', 'coda')
modelQuit()

This will have create the following CODA files

codaCODAindex.txt
codaCODAchain1.txt

Using with R

Personal tools