Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

testBUGSmodel

Tests BUGS examples in the NIMBLE system


Description

testBUGSmodel builds a BUGS model in the NIMBLE system and simulates from the model, comparing the values of the nodes and their log probabilities in the uncompiled and compiled versions of the model

Usage

testBUGSmodel(example = NULL, dir = NULL, model = NULL, data = NULL,
  inits = NULL, useInits = TRUE, expectModelWarning = FALSE,
  debug = FALSE, verbose = nimbleOptions("verbose"))

Arguments

example

(optional) example character vector indicating name of BUGS example to test; can be null if model is provided

dir

(optional) character vector indicating directory in which files are contained, by default the classic-bugs directory if the installed package is used; to use the current working directory, set this to ""

model

(optional) one of (1) a character string giving the file name containing the BUGS model code, (2) an R function whose body is the BUGS model code, or (3) the output of nimbleCode. If a file name, the file can contain a 'var' block and 'data' block in the manner of the JAGS versions of the BUGS examples but should not contain references to other input data files nor a const block. The '.bug' or '.txt' extension can be excluded.

data

(optional) one of (1) character string giving the file name for an R file providing the input constants and data as R code [assigning individual objects or as a named list] or (2) a named list providing the input constants and data. If neither is provided, the function will look for a file named example-data including extensions .R, .r, or .txt.

inits

(optional) (1) character string giving the file name for an R file providing the initial values for parameters as R code [assigning individual objects or as a named list] or (2) a named list providing the values. If neither is provided, the function will look for a file named example-init or example-inits including extensions .R, .r, or .txt.

useInits

boolean indicating whether to test model with initial values provided via inits.

expectModelWarning

boolean indicating whether nimbleModel is expected to produce a warning or character string giving part of expected warning.

debug

logical indicating whether to put the user in a browser for debugging when testBUGSmodel calls readBUGSmodel. Intended for developer use.

verbose

logical indicating whether to print additional logging information

Details

Note that testing without initial values may cause warnings when parameters are sampled from improper or fat-tailed distributions

Author(s)

Christopher Paciorek

Examples

## Not run: 
testBUGSmodel('pump')

## End(Not run)

nimble

MCMC, Particle Filtering, and Programmable Hierarchical Modeling

v0.11.0
BSD_3_clause + file LICENSE | GPL (>= 2)
Authors
Perry de Valpine [aut], Christopher Paciorek [aut, cre], Daniel Turek [aut], Nick Michaud [aut], Cliff Anderson-Bergman [aut], Fritz Obermeyer [aut], Claudia Wehrhahn Cortes [aut] (Bayesian nonparametrics system), Abel Rodrìguez [aut] (Bayesian nonparametrics system), Duncan Temple Lang [aut] (packaging configuration), Sally Paganin [aut] (reversible jump MCMC), Jagadish Babu [ctb] (code for the compilation system for an early version of NIMBLE), Lauren Ponisio [ctb] (contributions to the cross-validation code), Peter Sujan [ctb] (multivariate t distribution code)
Initial release
2021-04-16

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.