This function obtains the autocorrelation of the MCMC samples in an JointAI
object via coda::autocorr.diag(). autocorr_plot() visualizes the results
using ggplot2.
a matrix or a list of matrix objects if by_chain = TRUE, or
a ggplot() object for autocorr_plot().
Arguments
object
an object of class JointAI
lags
a numeric vector indicating the lags to consider
by_chain
logical; should the autocorrelation be computed for each
chain separately?
outcome
integer; index of the outcome model for which the
autocorrelation should be plotted
start
the first iteration of interest
(see window.mcmc)
end
the last iteration of interest
(see window.mcmc)
thin
thinning interval (integer; see window.mcmc).
For example, thin = 1 (default) will keep the MCMC samples
from all iterations; thin = 5 would only keep every 5th
iteration.