Learn R Programming

ivd (version 1.0.0)

build_ivd_model: Build and compile NIMBLE model and MCMC once This function is exported for use in 'future' and is not meant to be called by user.

Description

Build and compile NIMBLE model and MCMC once This function is exported for use in 'future' and is not meant to be called by user.

Usage

build_ivd_model(code, constants, dummy_data, dummy_inits, useWAIC = TRUE)

Value

A named list with two elements:

  • cmodel: The compiled NIMBLE model object produced by compileNimble().

  • cmcmc: The compiled NIMBLE MCMC object, created using buildMCMC() and compileNimble(), configured to monitor the model parameters (including WAIC monitors if useWAIC = TRUE).

The function is intended for internal use (e.g., within parallel workers) and is not meant to be called directly by end users.

Arguments

code

Nimble code

constants

Constants

dummy_data

Data

dummy_inits

inits

useWAIC

Defaults to TRUE. Nimble argument

Examples

Run this code
if (FALSE) {
library(nimble)
# Generic nimble example
code <- nimbleCode({
  mu ~ dnorm(0, 1)
  x  ~ dnorm(mu, 1)
})

constants   <- list()
dummy_data  <- list(x = 0)
dummy_inits <- list(mu = 0)

out <- build_ivd_model(
  code        = code,
  constants   = constants,
  dummy_data  = dummy_data,
  dummy_inits = dummy_inits,
  useWAIC     = FALSE
)

str(out)
}

Run the code above in your browser using DataLab