post_subset {postpack} | R Documentation |
Extract samples from specific nodes
Description
Subsets a smaller portion from a mcmc.list
object
corresponding only to the node(s) requested.
Usage
post_subset(
post,
params,
matrix = FALSE,
iters = FALSE,
chains = FALSE,
auto_escape = TRUE
)
Arguments
post |
A |
params |
A vector of regular expressions specifying the nodes to match for subsetting.
Accepts multi-element vectors to match more than one node at a time.
See |
matrix |
|
iters |
Retain the iteration number of each sample if |
chains |
Retain the chain number of each sample if |
auto_escape |
Automatically escape |
Value
A mcmc.list
or matrix
object, depending on the
value of the matrix
argument. Object contains all nodes that match the params
argument;
an error will be returned if no matches are found.
See Also
Examples
# load example mcmc.list
data(cjs)
# create mcmc.list with all nodes that contain "B0"
x1 = post_subset(cjs, "B0")
# create mcmc.list with all nodes that contain "b" or "B"
x2 = post_subset(cjs, c("b", "B"))
# perform the subset and return a matrix as output, while retaining the chain ID
x3 = post_subset(cjs, "B0", matrix = TRUE, chain = TRUE)