Download Package `runjags`

Transcript
autorun.jags
3
Author(s)
Matthew Denwood <[email protected]>
See Also
readline,
menu
Examples
# Ask the user if they want to proceed
## Not run:
ask("Do you want to start the program now?", type="logical")
## End(Not run)
autorun.jags
Run or Extend a User Specified Bayesian MCMC Model in JAGS with
Automatically Calculated Run Length and Convergence Diagnostics
Description
Runs or extends a user specified JAGS (similar to WinBUGS) model from within R, returning an
object of class runjags-class. Chain convergence over the first run of the simulation is assessed
using the Gelman and Rubin’s convergence diagnostic. If necessary, the simulation is extended
to improve chain convergence (up to a user-specified maximum time limit), before the required
sample size of the Markov chain is calculated using Raftery and Lewis’s diagnostic. The simulation
is extended to the required sample size dependant on autocorrelation and the number of chains.
This function is provided primarily for automated running of large simulated data studies, and is not
a replacement for manually assessing convergence and Monte Carlo error when parameter estimates
are being made from real data. For more complex models, the use of run.jags directly with manual
assessment of necessary run length may be preferable.
Requires Just Another Gibbs Sampler (JAGS), see http://www-fis.iarc.fr/~martyn/software/
jags/.
Usage
autorun.jags(model=stop("No model supplied"), monitor = NA, data=NA,
n.chains=NA, inits = NA, startburnin = 5000, startsample = 10000,
datalist=NA, initlist=NA, psrf.target = 1.05, normalise.mcmc = TRUE,
check.stochastic = TRUE, modules=c(""), factories=c(""),
raftery.options = list(), crash.retry=1, summarise = TRUE,
confidence=0.95, plots = summarise, thin.sample = FALSE, jags =
findjags(), silent.jags = FALSE, interactive=FALSE, max.time=Inf,
adaptive=list(type="burnin", length=200), thin = 1, monitor.deviance