Subsets a smaller portion from a mcmc.list object corresponding only to the node(s) requested.

post_subset(
  post,
  params,
  matrix = FALSE,
  iters = FALSE,
  chains = FALSE,
  auto_escape = TRUE
)

Arguments

post

A mcmc.list object.

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 match_params() and vignette("pattern-matching") for more details.

matrix

Return samples in matrix rather than mcmc.list format?

iters

Retain the iteration number of each sample if matrix = TRUE? Not used otherwise.

chains

Retain the chain number of each sample if matrix = TRUE? Not used otherwise.

auto_escape

Automatically escape "[" and "]" characters for pattern matching? See match_params() for details.

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)