opts_jagr: Get and set jaggernaut options

Description Usage Arguments Details Value See Also Examples

Description

Queries and sets options for JAGS analyses.

Usage

1
2
3

Arguments

...

options can be defined using name = value or by passing a list of such tagged values.

Details

The function opts_jagr(), which can aso be invoked using its alias options_jaggernaut(), behaves just like the options() function in the base library, with the additional feature that opts_jagr(mode="default") will reset all options to the values for the default mode. There are six available modes: debug, explore, test and demo report and paper. In summary the debug model should be used when first trying to code models in the JAGS dialect of the BUGS language. Once the JAGS code is running without errors is now time to switch to the explore model to look at model adequacy. Once you are content that the model is adequate you can now switch to report model to extract the results for presentation in a report or paper model if you are going to be sending the results to a peer-reviewed journal. The default mode is report mode. test and demo mode are used internally when testing the package and running demos respectively.

Available options are

level

the credible interval level (default = 0.95)

estimate

the type ("mean" or "median") of the point estimate (default = "mean")

nchains

the number of MCMC chains (default = 3)

nresample

the number of times to resample until convergence is achieved (default = 3)

nsamples

the total number of MCMC samples to thin from the second halves of the MCMC chains (default = 1000)

parallel

whether in parallel.

quiet

whether to suppress messages (default = FALSE)

convergence

the R-hat threshold for convergence (default = 1.1)

By default a JAGS analysis will retain a minumum of 1,000 MCMC samples thinned from the second halves of three chains. For example if niters = 1000 in the analysis then by default 334 samples will be thinned from the last 500 iterations of each chain.

Convergence is considered to have been achieved when all the monitored parameters have an R-hat less than the value of the convergence option which by default is 1.1 (Kery & Schaub 2011). If the initial number of iterations are performed and the convergence target has not been achieved and nresample > 0 then the value of niters is doubled, the MCMC sampling to date is considered the burn in period, the saved MCMC samples are discarded and MCMC sampling continues. This process is repeated until the convergence target is achieved or resampling would exceed the value of the nresample argument.

Value

For opts_jagr() a list of all jaggernaut options values sorted by name. For opts_jagr(name) a list of length one of the option value. When setting one or more options a list with the previous values of the options unchanged (returned invisibly).

See Also

jags_analysis and options

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
opts_jagr()
opts_jagr(mode = "debug")
options_jaggernaut()
opts_jagr("nchains","mode")
opts_jagr(nchains = 4)
opts_jagr("nchains","mode")
old <- opts_jagr(mode = "default") 
opts_jagr()
opts_jagr(old)
opts_jagr("nchains","mode") 

poissonconsulting/jaggernaut documentation built on Feb. 18, 2021, 11:10 p.m.