initializeModel | R Documentation |
Performs initialization of nimble model node values and log probabilities
initializeModel(model, silent = FALSE)
model |
A setup argument, which specializes an instance of this nimble function to a particular model. |
silent |
logical indicating whether to suppress logging information |
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.
Daniel Turek
myNewAlgorithm <- nimbleFunction(
setup = function(model, ...) {
my_initializeModel <- initializeModel(model)
....
},
run = function(...) {
my_initializeModel()
....
}
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.