Skip to contents

The window.mcmc function subsets a Markov Chain Monte Carlo (MCMC) object by selecting iterations within a specified time window.

Usage

# S3 method for class 'mcmc'
window(x, start, end, thin, ...)

Arguments

x

An object of class mcmc, representing a single MCMC chain.

start

The starting iteration (time) for the subset. If not provided, the starting time of the original chain is used.

end

The ending iteration (time) for the subset. If not provided, the ending time of the original chain is used.

thin

The thinning interval to be applied. If not provided, the original thinning interval is used. If thin is not a multiple of the original thinning interval, a warning is issued and the original thinning interval is retained.

...

Additional arguments (currently not used).

Value

A new mcmc object representing the subsetted chain with the specified start, end, and thinning parameters.

Details

This function allows you to focus on a specific window of iterations within an MCMC chain. It adjusts the start and end points according to the provided values, ensuring they align with the chain's iterations. The thinning interval can also be adjusted, but it must be a multiple of the original thinning interval; otherwise, a warning is issued and the original interval is kept.

Examples

# Assume `mcmc_chain` is an object of class `mcmc`
# Subset the MCMC chain to include only iterations between 500 and 1000
windowed_chain <- window.mcmc(mcmc_chain, start = 500, end = 1000, thin = 2)
#> Error in window.mcmc(mcmc_chain, start = 500, end = 1000, thin = 2): could not find function "window.mcmc"