Learn R Programming

bssm (version 0.1.11)

expand_sample: Expand the Jump Chain representation

Description

The MCMC algorithms of bssm use a jump chain representation where we store the accepted values and the number of times we stayed in the current value. Although this saves bit memory and is especially convenient for IS-corrected MCMC, sometimes we want to have the usual sample paths. Function expand_sample returns the expanded sample based on the counts. Note that for IS-corrected output the expanded sample corresponds to the approximate posterior.

Usage

expand_sample(x, variable = "theta", times, states, by_states = TRUE)

Arguments

x

Output from run_mcmc.

variable

Expand parameters "theta" or states "state".

times

Vector of indices. In case of states, what time points to expand? Default is all.

states

Vector of indices. In case of states, what states to expand? Default is all.

by_states

If TRUE (default), return list by states. Otherwise by time.