View source: R/coupled_chains.R
sample_coupled_chains | R Documentation |
Sample two Markov chains, each following 'single_kernel' marginally, and 'coupled_kernel' jointly, until min(max(tau, m), max_iterations), where tau is the first time the two chains meet (the "meeting time").
Or more precisely, they meet with a delay of lag, i.e. X_t = Y_t-lag, and lag is one by default.
Once the coupled chains are obtained, unbiased estimators can be computed for arbitrary test
functions via the function H_bar
.
If you're only interested in sampling meeting times, see sample_meetingtime
.
sample_coupled_chains( single_kernel, coupled_kernel, rinit, m = 1, lag = 1, max_iterations = Inf, preallocate = 10 )
single_kernel |
A list taking a state and returning a state, performing one step of a Markov kernel |
coupled_kernel |
A list taking two states and returning two states, performing one step of a coupled Markov kernel; it also returns a boolean "identical" indicating whether the two states are identical. |
rinit |
A list representing the initial state of the chain, that can be given to 'single_kernel' |
m |
A time horizon: the chains are sampled until the maximum between m and the meeting time |
lag |
A time lag, equal to one by default |
max_iterations |
A maximum number of iterations, at which to interrup the while loop; Inf by default |
preallocate |
A number of anticipated iterations, used to pre-allocate memory; 10 by default |
A list with
samples1: the first chain, of length max(m, tau)
samples2: the second chain, of length max(m, tau) - lag
meetingtime: the meeting time; equal to Inf if while loop was interrupted
iteration: final iteration; could be equal to m, to meetingtime, or to max_iterations
elapsedtime: elapsed wall-clock time, in seconds
cost: computing cost in terms of calls to Markov kernels (counting coupled kernel as twice the cost)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.