doRJAGS: doRJAGS

View source: R/FUNCTION_doRJAGS.R

doRJAGSR Documentation

doRJAGS

Description

This function is a wrapper for calls to the jags() function of the R2jags package. It is designed for use inside the calcMCMCRickerBM() function, but can be used on its own if you are familiar with BUGS models. Check the code for calcMCMCRickerBM() to see the details. This function is adapted from forecasting code originally developed in collaboration with Sue Grant and Bronwyn MacDonald. Note: This requires installing JAGS from here.

Usage

doRJAGS(
  data.obj,
  model.fn,
  settings = list(n.chains = 2, n.burnin = 20000, n.thin = 60, n.samples = 50000),
  inits,
  pars.track,
  output = "short",
  out.path = "MCMC_Out",
  out.label = "MCMC",
  mcmc.seed = "default",
  tracing = FALSE,
  sr.yrs = NA
)

Arguments

data.obj

a list object with Spn and Rec (Data for 1 Stock!), as well as the required priors (details depend on model). Other variables can be there but are not used (RpS, Qual, ExpF etc)

model.fn

a function that defines a BUGS model

settings

a list with n.chains (2), n.burnin (20000), n.thin (60), and n.samples (50000). Default values in brackets.

inits

a list of lists with inits for each chain. Depens on BUGS model

pars.track

vector of text strings listing parameters to track. Depends on BUGS model

output

one of "short" (only return summary stats for tracked parameters in a list object), "post" (also save posterior distribution samples to folder), or "all" (also produce pdf files with standard diagnostic plots)

out.path

text string specifying folder. if output is "post" or "all", the generated files will be stored to this folder

out.label

label use in the output files if output is "post" or "all"

mcmc.seed

either "default" or an integer giving the random seed for starting MCMC (R2Jags default is 123)

tracing

if TRUE, diagnostic details for intermediate objects will be printed to the screen for

optional

vector to provide brood years matching the data points (for labelling output)


SOLV-Code/RapidRicker documentation built on Jan. 14, 2025, 9:36 a.m.