View source: R/v03_RWNNGP_sampler.R
| RWNNGP_setup | R Documentation |
Pre-calculates the local graph structure, target indices, and specific
coordinate strings within the AD matrix for a single target node.
This forms the control list payload needed by sampler_RW_NN_GP.
RWNNGP_setup(node_id, AD, neighbors.id, Rneighbors.id, N.neighbors, k = k)
node_id |
Integer. The index of the specific spatial location currently
being set up for targeted random-walk sampling (ranges from 1 to |
AD |
Character. The name of the matrix containing the NNGP coefficients
within the NIMBLE model object (typically passed as a string like |
neighbors.id |
Integer matrix ( |
Rneighbors.id |
Integer vector. The reverse neighbor indices (children)
for |
N.neighbors |
Integer vector. A vector of length |
k |
Integer. The maximum number of neighbors specified in the NNGP configuration. |
This utility is designed to run in an R loop when configuring an MCMC specification
prior to model compilation. By converting matrix indexing operations into explicit
character node paths (e.g., "AD[5,1]"), it shifts the burden of matrix searching
from the runtime execution loop of the C++ compiled sampler into a one-time R setup cost.
It maps out how a change in node_id will ripple through its forward neighbors
and back through the reverse neighbors whose conditional distributions depend directly
on the target node's value.
A named list containing specific structural elements for the target node:
update_id: Integer vector combining the node_id and its reverse neighbors.
Fneighbors.id: Integer vector containing non-zero forward neighbor indices.
AFnodes: Character vector of parsed string addresses pointing to forward coefficients.
ARnodes: Character vector of parsed string addresses pointing to reverse coefficients.
A.neighbors: Flattened character vector of matrix addresses representing all relevant
neighborhood coefficients needed to re-evaluate residuals during the loop.
Fabian Ketwaroo
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.