LaplacesDemon (version 16.1.4)

caterpillar.plot: Caterpillar Plot

Description

A caterpillar plot is a horizontal plot of 3 quantiles of selected distributions. This may be used to produce a caterpillar plot of posterior samples (parameters and monitored variables) from an object either of class demonoid, demonoid.hpc, iterquad, laplace, pmc, vb, or a matrix.

Usage

caterpillar.plot(x, Parms=NULL, Title=NULL)

Arguments

x

This required argument is an object of class demonoid, codedemonoid.hpc, iterquad, laplace, pmc, vb, or a \(S \times J\) matrix of \(S\) samples and \(J\) variables. For an object of class demonoid, the distributions of the stationary posterior summary (Summary2) will be attempted first, and if missing, then the parameters of all posterior samples (Summary1) will be plotted. For an object of class demonoid.hpc, stationarity may differ by chain, so all posterior samples (Summary1) are used. For an object of class laplace or vb, the distributions in the posterior summary, Summary, are plotted according to the posterior draws, sampled with sampling importance resampling in the SIR function. When a generic matrix is supplied, unimodal 95% HPD intervals are estimated with the p.interval function.

Parms

This argument accepts a vector of quoted strings to be matched for selecting parameters and monitored variables for plotting (though all parameters are selected when a generic matrix is supplied). This argument defaults to NULL and selects every parameter for plotting. Each quoted string is matched to one or more parameter names with the grep function. For example, if the user specifies Parms=c("eta", "tau"), and if the parameter names are beta[1], beta[2], eta[1], eta[2], and tau, then all parameters will be selected, because the string eta is within beta. Since grep is used, string matching uses regular expressions, so beware of meta-characters, though these are acceptable: ".", "[", and "]".

Title

This argument accepts a title for the plot.

Details

Caterpillar plots are popular plots in Bayesian inference for summarizing the quantiles of posterior samples. A caterpillar plot is similar to a horizontal boxplot, though without quartiles, making it easier for the user to study more distributions in a single plot. The following quantiles are plotted as a line for each parameter: 0.025 and 0.975, with the exception of a generic matrix, where unimodal 95% HPD intervals are estimated (for more information, see p.interval). A vertical, gray line is included at zero. For all but class demonoid.hpc, the median appears as a black dot, and the quantile line is black. For class demonoid.hpc, the color of the median and quantile line differs by chain; the first chain is black and additional chains appear beneath.

See Also

IterativeQuadrature, LaplaceApproximation, LaplacesDemon, LaplacesDemon.hpc, PMC, p.interval, SIR, and VariationalBayes.

Examples

Run this code
# NOT RUN {
#An example is provided in the LaplacesDemon function.
# }

Run the code above in your browser using DataCamp Workspace