extractValues: Extract sampled parameter values from an mcmc.list

View source: R/extractValues.R

extractValuesR Documentation

Extract sampled parameter values from an mcmc.list

Description

This function makes it easy to extract sampled values of one or more parameters. The function can extract multiple parameters from multiple chains

Usage

extractValues(x, params, chain = NULL, drop = TRUE, ...)

Arguments

x

an object of class mcmc.list - usually from coda.samples

params

a vector of one or more strings OR regular expressions which identifies the parameters we want to extract from the chain

chain

the chain, or chains we want to extract the parameters from. If chain is NULL then the values will be extracted from all chains.

drop

used to preserve the dimensions of an array. If a single parameter is requested, then the results will be returned as a vector rather than a matrix if drop == TRUE.

...

any other arguments. Not used yet.

Value

If there is only one chain or the user asks for results from exactly one chain, then a matrix with class mcmc will be returned containing only the parameters of interest in the columns. The column names of the matrix will correspond to the parameter. If there is more than one chain, and the user asks for results from more than one chain, or alternatively leaves chain as NULL, then a list of matrices with class mcmc will be returned where each matrix contains only the parameters of interest in the columns. The column names of each of the matrices will correspond to the parameter.


jmcurran/jaggR documentation built on Nov. 2, 2023, 11:04 a.m.