subset.mcmc.list: Subset mcmc.list Object

Description Usage Arguments Details Value Examples

View source: R/subset.R

Description

Subsets an mcmc.list object by its chains, parameters and/or iterations.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## S3 method for class 'mcmc.list'
subset(
  x,
  chains = NULL,
  iters = NULL,
  pars = NULL,
  iterations = NULL,
  parameters = NULL,
  ...
)

Arguments

x

An mcmc.list object.

chains

An integer vector of chains.

iters

An integer vector of iterations.

pars

A character vector of parameter names.

iterations

An integer vector (or NULL) of the iterations to subset by.

parameters

A character vector (or NULL) of the parameters to subset by.

...

Unused.

Details

Future versions should allow it to be reordered by its parameters.

Value

An mcmc.list object.

Examples

1
2
3
4
mcmc.list <- as_mcmc_list(nlists(nlist(beta = 1:2, theta = 1), 
                                 nlist(beta = 3:4, theta = -1)))
subset(mcmc.list, pars = "beta")
subset(mcmc.list, iters = c(1L,1L))

nlist documentation built on Sept. 5, 2021, 6:05 p.m.