MCMCpstr: Summary function for MCMC output that preserves parameter...

Description Usage Arguments Details Examples

View source: R/MCMCpstr.R

Description

Extract summary information from MCMC output (specific function specified) for specific parameters of interest while preserving original parameter structure (i.e., scalar, vector, matrix, array). Function outputs a list with calculated values for each specified parameter.

Usage

1
2
MCMCpstr(object, params = "all", excl = NULL, ISB = TRUE, digits = 2,
  func = mean)

Arguments

object

Object containing MCMC output. See DETAILS below.

params

Character string (or vector of character strings) denoting parameters to be returned in summary output.

Default 'all' returns all parameters in summary output.

excl

Character string (or vector of character strings) denoting parameters to exclude. Used in conjunction with params argument to select parameters of interest.

ISB

Ignore Square Brackets (ISB). Logical specifying whether square brackets should be ignored in the params and excl arguments. If TRUE, square brackets are ignored - input from params and excl are otherwise matched exactly. If FALSE, square brackets are not ignored - input from params and excl are matched using grep, which can take arguments in regular expression format. This allows partial names to be used when specifying parameters of interest.

digits

Number of digits to include for posterior summary. Values will be rounded to the specified number of digits (except for Rhat which is always rounded to 2 digits).

Default is digits = 2.

func

Function to be performed on MCMC output. Output of specified function must be of length 1.

Details

object argument can be a stanfit object (rstan package), an mcmc.list object (coda package), an R2jags model object (R2jags package), a jagsUI model object (jagsUI package), or a matrix containing MCMC chains (each column representing MCMC output for a single parameter, rows representing iterations in the chain). The function automatically detects the object type and proceeds accordingly.

Examples

1
2
3
4
#Load data
data(MCMC_data)

MCMCpstr(MCMC_data, func = function(x) quantile(x, probs = 0.01))

MCMCvis documentation built on April 5, 2018, 5:07 p.m.