getConditionallyIndependentSets {nimble} | R Documentation |
Get a list of conditionally independent sets of nodes in a nimble model
Description
A conditionally independent set of nodes is such that the joint probability (density) of nodes in the set will not change even if any non-given node outside the set is changed. Default given nodes are data nodes and parameter nodes (aka "top-level" nodes, i.e. nodes with no parent nodes), but this can be controlled.
Usage
getConditionallyIndependentSets(
model,
nodes,
givenNodes,
omit = integer(),
explore = c("both", "down", "up"),
unknownAsGiven = TRUE,
returnType = "names",
returnScalarComponents = FALSE,
endAsGiven = FALSE
)
Arguments
model |
A nimble model object (uncompiled or compiled), such as returned
by |
nodes |
A vector of stochastic node names (or their graph IDs) to split
into conditionally independent sets, conditioned on the |
givenNodes |
A vector of node names or their graph IDs that should be
considered as fixed (given) and hence can be conditioned on. If omitted,
the default will be all data nodes and all parameter nodes, the latter
defined as nodes with no stochastic parent nodes (skipping over
deterministic parent nodes). See |
omit |
A vector of node names or their graph IDs that should be omitted and should block further graph exploration. |
explore |
The method of graph exploration, which may corresond to what
the |
unknownAsGiven |
Logical for whether a model node not in |
returnType |
Either "names" for returned nodes to be node names or "ids" for returned nodes to be graph IDs. |
returnScalarComponents |
If FALSE (default), multivariate nodes are
returned as full names (e.g. |
endAsGiven |
If TRUE, end nodes (defined as nodes with stochastic
parents but no stochastic children, skipping through deterministic nodes)
are included in the default for |
Details
This function returns sets of conditionally independent nodes.
Multiple input nodes
might be in the same set or different sets.
The nodes
input and the returned sets include only stochastic nodes
because conditional independence is a property of random variables.
Deterministic nodes are considered in determining the sets. givenNodes
may contain stochastic or deterministic nodes.
Value
List of nodes that are in conditionally independent sets. With each set, nodes are returned in topologically sorted order. The sets themselves are returned in topologically sorted order of their first nodes.
Other nodes (not in nodes
) may be included in the output if
unknownAsGiven=FALSE
.
Author(s)
Perry de Valpine