method_window: Subsetting chains for 'mcmcOutput' objects

window.mcmcOutputR Documentation

Subsetting chains for mcmcOutput objects

Description

The window method extracts the subset of the draws between start and end. Setting thin = k selects every kth observation starting from start.

Use window to discard additional draws at the start of the chain if extra burn-in is required, or to reduce the size of the object by thinning. See the examples.

Any previous burn-in or thinning is ignored (unlike the coda::window.mcmc method).

Usage

## S3 method for class 'mcmcOutput'
window(x, start=1, end=NULL, thin=1, ...)

Arguments

x

an object of class mcmcOutput.

start

the first observation to retain.

end

the last observation to retain; if NULL, this is set to the end of the chain.

thin

the interval between retained observations.

...

further arguments for other methods (not used).

Value

Returns an object of class mcmcOutput with the subset of observations.

Author(s)

Mike Meredith.

Examples

data(mcmcListExample)
mco <- mcmcOutput(mcmcListExample)
mco

new1 <- window(mco, start=201) # Discard the first 200 draws in each chain
new1  # Now only 800 per chain.

new2 <- window(mco, thin=3) # Retain only 1/3 of the draws
new2  # new2 is smaller; each chain reduced from 1000 to 333, total draws 999.


mcmcOutput documentation built on Nov. 18, 2022, 1:08 a.m.