nimble (version 0.7.0)

initializeModel: Performs initialization of nimble model node values and log probabilities

Description

Performs initialization of nimble model node values and log probabilities

Usage

initializeModel(model, silent = FALSE)

Arguments

model

A setup argument, which specializes an instance of this nimble function to a particular model.

silent

logical indicating whether to suppress logging information

Details

This nimbleFunction may be used at the beginning of nimble algorithms to perform model initialization. The intended usage is to specialize an instance of this nimbleFunction in the setup function of an algorithm, then execute that specialied function at the beginning of the algorithm run function. The specialized function takes no arguments.

Executing this function ensures that all right-hand-side only nodes have been assigned real values, that all stochastic nodes have a real value, or otherwise have their simulate() method called, that all deterministic nodes have their simulate() method called, and that all log-probabilities have been calculated with the current model values. An error results if model initialization encounters a problem, for example a missing right-hand-side only node value.

Examples

Run this code
# NOT RUN {
myNewAlgorithm <- nimbleFunction(
   setup = function(model, ...) {
      my_initializeModel <- initializeModel(model)
      ....
   },
   run = function(...) {
      my_initializeModel()
      ....
   }
)
# }

Run the code above in your browser using DataLab