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.
expand_sample(x, variable = "theta", times, states, by_states = TRUE)
Output from run_mcmc
.
Expand parameters "theta"
or states "state"
.
Vector of indices. In case of states, what time points to expand? Default is all.
Vector of indices. In case of states, what states to expand? Default is all.
If TRUE
(default), return list by states. Otherwise by time.