joint.density.plot {LaplacesDemon} | R Documentation |
Joint Density Plot
Description
This function plots the joint kernel density from samples of two marginal posterior distributions.
Usage
joint.density.plot(x, y, Title=NULL, contour=TRUE, color=FALSE, Trace=NULL)
Arguments
x , y |
These are vectors consisting of samples from two marginal
posterior distributions, such as those output by
|
Title |
This is the title of the joint posterior density plot. |
contour |
This logical argument indicates whether or not contour
lines will be added to the plot. |
color |
This logical argument indicates whether or not color will
be added to the plot. |
Trace |
This argument defaults to |
Details
This function produces either a bivariate scatterplot that may have kernel density contour lines added, or a bivariate plot with kernel density-influenced colors, which may also have kernel density contour lines added. A joint density plot may be more informative than two univariate density plots.
The Trace
argument allows the user to view the exploration of
the joint density, such as from MCMC chain output. An efficient
algorithm jumps to random points of the joint density, and an
inefficient algorithm explores more slowly. The initial point of the
trace (which is the first element passed to Trace
) is plotted
with a green dot. The user should consider plotting the joint density of
the two marginal posterior distributions with the highest
IAT
, as identified with the
PosteriorChecks
function, since these are the two least
efficient MCMC chains. Different sequences of iterations may be
plotted. This ‘joint trace plot’ may show behavior of the MCMC
algorithm to the user.
Author(s)
Statisticat, LLC. software@bayesian-inference.com
See Also
IAT
,
LaplacesDemon
, and
PosteriorChecks
Examples
library(LaplacesDemon)
X <- rmvn(1000, runif(2), diag(2))
joint.density.plot(X[,1], X[,2], Title="Joint Density Plot",
contour=TRUE, color=FALSE)
joint.density.plot(X[,1], X[,2], Title="Joint Density Plot",
contour=FALSE, color=TRUE)
joint.density.plot(X[,1], X[,2], Title="Joint Density Plot",
contour=TRUE, color=TRUE)
joint.density.plot(X[,1], X[,2], Title="Joint Trace Plot",
contour=FALSE, color=TRUE, Trace=c(1,10))