genBugsScript             package:rbugs             R Documentation

_G_e_n_e_r_a_t_i_n_g _S_c_r_i_p_t _F_i_l_e _f_o_r _B_U_G_S

_D_e_s_c_r_i_p_t_i_o_n:

     Generating a script file to run BUGS batch-mode.

_U_s_a_g_e:

     genBugsScript(paramSet, n.chains, n.iter, n.burnin, n.thin,
                   model.file, data.file, inits.files,
                   workingDir=NULL, bugsWorkingDir=getwd(),
                   script, debug = FALSE, useWine = FALSE)

_A_r_g_u_m_e_n_t_s:

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.

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.

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

bugsWorkingDir: A character string specifying the directory which is
          recognizable by windows, if using wine.

  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.

 useWine: If TRUE, BUGS is used via wine.

_D_e_t_a_i_l_s:

     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.

_V_a_l_u_e:

     None.

_A_u_t_h_o_r(_s):

     Jun Yan jyan@stat.uiowa.edu

_S_e_e _A_l_s_o:

     'genDataFile', 'genInitsFile', 'format4Bugs'

_E_x_a_m_p_l_e_s:

     ## 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="/var/scratch/c/tmp/model.txt",
                   data.file="/var/scratch/c/tmp/data.txt",
                   inits.file=c("/var/scratch/c/tmp/init1.txt",
                                "/var/scratch/c/tmp/init2.txt"),
                   workingDir="/var/scratch/c/tmp",
                   bugsWorkingDir="c:/tmp",
                   script=script.file,
                   debug=FALSE, useWine=TRUE)
     file.show(script.file)
     unlink(script.file)
     ## End(Not run)

