genBugsScript: Generating Script File for BUGS

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/genOpenBugsScript.R

Description

Generating a script file to run BUGS batch-mode.

Usage

1
2
3
4
5
genBugsScript(paramSet, n.chains, n.iter, n.burnin, n.thin, dic,
              model.file, data.file, inits.files,
              bugsWorkingDir=getwd(),
              script, debug = FALSE,
              OpenBugs=TRUE, Windows=TRUE, seed=NULL)

Arguments

paramSet

A character vector of the names of the parameter to be monitored.

n.chains

The number of chains to be monitored.

n.iter

The number of iterations of each chain.

n.burnin

The length of the burn-in.

n.thin

Thinning rate.

dic

If TRUE, dic will be monitored

model.file

A character string of the name of file which contains the model specification for BUGS. It should end with .txt to be recognizable by BUGS.

data.file

A character string of the name of the data file. It should end with .txt to be recognizable by BUGS.

inits.files

A vector of file names of initial values. They should end with .txt to be recognizable by BUGS.

bugsWorkingDir

A character string specifying the directory to store temporary files for running BUGS.

script

A character string naming the files to print the script to. It must end with .txt to be recognizable by BUGS.

debug

A logical value indicating whether or not closing the BUGS window after running the script.

OpenBugs

If TRUE, OpenBugs is used.

Windows

If TRUE, Windows plataform is used.

seed

An integer of random number seed.

Details

This function only write a script to ‘script’, which uses the file names of ‘model.file’, ‘data.file’, and ‘inits.files’, without actually reading them. These file names should be correct when using runBugs.

workingDir and bugsWorkingDir establish the translation between a directory native to the operating system and a directory recognizable by wine. They are the same if useWine == FALSE.

Value

None.

Author(s)

Jun Yan jyan@stat.uconn.edu and Marcos Prates marcosop@est.ufmg.br

See Also

genDataFile, genInitsFile, format4Bugs

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## no tested examples for mac-os.
## Not run: 
script.file <- paste(tempfile("script"), ".txt", sep="")
genBugsScript(paramSet=c("alpha", "theta"), n.chains=2, n.keep=1500,
              n.burnin=500, n.thin=1,
              model.file="~/tmp/model.txt",
              data.file="~/tmp/data.txt",
              inits.file=c("~/tmp/init1.txt",
                           "~/tmp/init2.txt"),
              bugsWorkingDir=" ~/tmp/",
              script=script.file)
file.show(script.file)
unlink(script.file)

## End(Not run)

rbugs documentation built on Jan. 15, 2019, 5:04 p.m.

Related to genBugsScript in rbugs...