View source: R/plot_mcmc_path.R
plot_mcmc_path | R Documentation |
This will produce a simple plot for visualizing the path of the variable steps (one variable moving at a time) or cycles (the movement of the variables after completing a cycle) for a list of MCMC chains stored as a list. The starting place of the chain *the first row of each chain) is denoted by a point. See Details.
plot_mcmc_path(
x,
ncycles = 10,
palette = "RdYlBu",
xlim,
ylim,
xlab = "var 1",
ylab = "var 2",
type = "step",
...
)
x |
A matrix with 2 columns or a list of 2 column matrices |
ncycles |
The number of cycles to plot |
palette |
a valid palette name (one of |
xlim |
x-axis limits |
ylim |
y-axis limits |
xlab |
x-axis label |
ylab |
y-axis label |
type |
Type of path to plot. |
... |
Additional parameters for the |
The function currently only works for chains with two variables stored as a 2-column matrix or data frame. Each column contains the MCMC samples of each variable.
The paths are distinguished by using different line colors. By default,
the "RdYlBu"
palette from hcl.colors
is used.
It is unlikely this color scheme will work well for more than 5 chains.
A plot.
x1 = cbind(rnorm(3), rchisq(3, df = 1))
x2 = cbind(rnorm(3), rchisq(3, df = 1))
x = list(x1, x2)
plot_mcmc_path(x)
# change point type
plot_mcmc_path(x, type = "cycle", pch = 20)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.