plot_autocorr: Checking convergence: autocorrelation plot

Description Usage Arguments Author(s) See Also Examples

View source: R/mcmc_plots.R

Description

This function can be used to assess convergence by visualizing the autocorrelations between the draws of the Markov chain chain. The lag k autocorrelation rho_k is the correlation between every draw and its kth lag. We would expect the kth lag autocorrelation to be smaller as k increases (that is, the 100th and 1000th draws should be less correlated than the 100th and 105th draws). For higher values of k we anticipate small autocorrelation values, otherwise the chain is not mixing well (in other words we do not explore the parameter space adequately).

For examples see

http://faculty.missouri.edu/~micheasa/sppmix/sppmix_all_examples.html#plot_autocorr

Usage

1
plot_autocorr(chain, open_new_window = FALSE, maxlag = 100)

Arguments

chain

An Lx1 vector containing the L posterior realizations.

open_new_window

Open a new window for the plot.

maxlag

The maximum lag value to consider. Default is 100.

Author(s)

Sakis Micheas

See Also

est_mix_damcmc, rmixsurf, rsppmix

Examples

1
2
3
4
5
6
7
truemix_surf <- rmixsurf(m = 3, lambda=100, xlim = c(-3,3), ylim = c(-3,3))
plot(truemix_surf)
genPPP=rsppmix(intsurf = truemix_surf, truncate = FALSE)
fit <- est_mix_damcmc(pp = genPPP, m = 3)
plot_autocorr(fit$genps[,1])
plot_autocorr(fit$genps[,2])
plot_autocorr(fit$genps[,3])

sppmix documentation built on Jan. 13, 2021, 10:04 p.m.