Usage
run.jags(model=stop("No model supplied"),
monitor = stop("No monitored variables supplied"),
data = NA, n.chains = 2, inits = replicate(n.chains, NA),
burnin = 5000*thin, sample = 10000*thin,
adapt=if(burninArguments
model
a character string of the model in the JAGS language. No
default.
monitor
a character vector of the names of variables to monitor.
For all models, specifying 'deviance' as a monitored variable will
calculate the model deviance. No default.
data
a character string in the R dump format (or a named list)
containing the data. If left as NA, no external data is used in the
model. Default NA.
n.chains
the number of chains to use for the simulation. Must be
a positive integer. Default 2.
inits
either a character vector with length equal to the number
of chains the model will be run using, or a list of named lists
representing names and corresponding values of inits for each chain. If
a vector, each element of the vector must be a character str
burnin
the number of burnin iterations (not sampled) to use
(numeric). Default 5000 iterations.
sample
the number of sampling iterations to use (numeric).
Default 10000 iterations.
adapt
advanced option to control the length of the adaptive phase
directly, which is otherwise half the length of the burnin period.
Default is 0, unless burnin is less than 200 in which case 100 adapitve
iterations are used.
jags
the system call or path for activating JAGS. Default calls
findjags() to attempt to locate JAGS on your system.
silent.jags
should the JAGS output be suppressed? (logical) If
TRUE, no indication of the progress of individual models is supplied.
Default FALSE.
check.conv
should the convergence be assessed after the model has
completed? If TRUE, each monitored variable will be assessed for a
potential scale reduction factor of the Gelman Rubin statistic of less
than 1.05, which indicates adequate convergence. 2 or more c
plots
should traceplots and density plots be produced for each
monitored variable? If TRUE, the returned list will include elements
'trace' and 'density' which consist of a list of lattice objects. The
alternative is to use plot(results$mcmc) to look at the d
psrf.target
the value of the point estimate for the potential
scale reduction factor of the Gelman Rubin statistic below which the
chains are deemed to have converged (must be greater than 1). Ignored
if check.conv==FALSE. Default 1.05.
normalise.mcmc
the Gelman Rubin statistic is based on the
assumption that the posterior distribution of monitored variables is
roughly normal. For very skewed posterior distributions, it may help to
log/logit transform the posterior before calculating the Gelman Rubin
check.stochastic
non-stochastic monitored variables will cause
errors when calculating the Gelman-Rubin statistic, if
check.stochastic==TRUE then all monitored variables will be checked to
ensure they are stochastic beforehand. This has a computational cost,
and can be b
modules
external modules to be loaded into JAGS. More than 1
module can be used. Default none.
thin
the thinning interval to be used in JAGS. Increasing the
thinning interval may reduce autocorrelation, and therefore reduce the
number of samples required, but will increase the time required to run
the simulation. Default 1.
monitor.deviance
option to monitor the deviance of each monitored
variable using the DIC module for JAGS. If TRUE, a 'deviance' element
is returned representing this value for each monitored variable at each
iteration. For more information see the JAGS user manual secti
monitor.pd
option to monitor the effective number of parameters
using the DIC module for JAGS. If TRUE, a 'pd' element is returned
representing this value at each iteration. For more information see the
JAGS user manual section 4.4. Default FALSE.
monitor.popt
option to monitor the optimism of the expected
deviance using the DIC module for JAGS. If TRUE, a 'popt' element is
returned representing this value at each iteration. For more
information see the JAGS user manual section 4.4. Default FALSE.
keep.jags.files
option to keep the folder with files needed to
call JAGS, rather than deleting it. May be useful for attempting to bug
fix models. Default FALSE.
tempdir
option to use the temporary directory as specified by the
system rather than creating files in the working directory. If
keep.jags.files==TRUE then the folder is copied to the working directory
after the job has finished (with a unique folder name based
method
the method with which to call JAGS; one of 'simple',
'interruptible' or 'parallel'. The former runs JAGS as a foreground
process (the default behaviour for runjags < 0.9.6), 'interruptible'
allows the JAGS process to be terminated immediately using the i