Learn R Programming

rbugs (version 0.5-9.1)

rbugs: Run BUGS from R in a BATCH

Description

Generate files (data, init, script) that are necessary to run BUGS, call BUGS through the OS, and collect the MCMC output.

Usage

rbugs(data, inits, paramSet, model,
      n.chains = 1, n.iter = 2000, n.burnin = floor(n.iter/2),
      n.thin = max(1, floor(n.chains * (n.iter - n.burnin)/1000)),
      dic = FALSE,
      debug = FALSE,
      bugs = system("which OpenBUGS", TRUE),
      bugsWorkingDir,
      OpenBugs = TRUE,
      cleanBugsWorkingDir = FALSE,
      genFilesOnly = FALSE,
      verbose = FALSE, seed = NULL)

Arguments

data

a list of data object to be used by BUGS

inits

a list of list of initial values, or a function which returns a list of initial values

paramSet

a vector of the names of the parameters to be monitored

model

the file name of the model description

n.chains

the number of chains to be monitored

n.iter

the number of iteration of each chain

n.burnin

the length of the burn-in

n.thin

thinning rate

dic

if TRUE, dic will be monitored

debug

a logical value indicating whether or not closing the BUGS window

bugs

the full name (including the path) of the BUGS executable

bugsWorkingDir

a directory to store all the intermediate files

OpenBugs

if TRUE, OpenBugs is used

cleanBugsWorkingDir

if TRUE, the generated files will be removed from the bugsWorkingDir

genFilesOnly

If TRUE, the script, data, inits, and model files will be generated but not run.

verbose

if TRUE, print the log file from BUGS

seed

an interger of random number seed

Value

A list with the inforamtion of the MCMC sample and each one of the nChains .

Examples

Run this code
# NOT RUN {
 ##see examples in \code{\link{pumps}} and \code{\link{schools}}
# }

Run the code above in your browser using DataLab