Learn R Programming

nimble (version 1.2.1)

values: Access or set values for a set of nodes in a model

Description

Get or set values for a set of nodes in a model

Usage

values(model, nodes, accessorIndex)

values(model, nodes, accessorIndex) <- value

Value

A vector of values concatenated from the provided nodes in the model

Arguments

model

a NIMBLE model object, either compiled or uncompiled

nodes

a vector of node names, allowing index blocks that will be expanded

accessorIndex

For internal NIMBLE use only

value

value to set the node(s) to

Author

NIMBLE development team

Details

Access or set values for a set of nodes in a NIMBLE model.

Calling values(model, nodes) returns a vector of the concatenation of values from the nodes requested P <- values(model, nodes) is a newer syntax for getValues(P, model, values), which still works and modifies P in the calling environment.

Calling values(model, nodes) <- P sets the value of the nodes in the model, in sequential order from the vector P.

In both uses, when requested nodes are from matrices or arrays, the values will be handled following column-wise order.

The older function getValues(P, model, nodes) is equivalent to P <- values(model, nodes), and the older function setValues(P, model, nodes) is equivalent to values(model, nodes) <- P

These functions work in R and in NIMBLE run-time code that can be compiled.