crossplot {jagshelper} | R Documentation |
Bivariate Plot of Posterior Densities
Description
Bivariate plot of the posterior densities of corresponding vectors of parameter nodes. Three plotting methods are provided, that may be overlayed if desired.
If
drawcross == TRUE
, caterpillar-like plots will be produced, with quantile intervals in the x- and y- directions.If
drawx == TRUE
, caterpillar-like plots will be produced, but rotated along the standardized principal component axes. This may be useful to draw if correlation is present.If
drawblob == TRUE
, smoothed polygons will be produced, each containing approximatelyci=
x100% of the associated MCMC samples.
All methods can overlay multiple bars or polygons, depending on the length of ci=
.
Usage
crossplot(
dfx,
dfy = NULL,
p = NULL,
col = 4,
drawcross = TRUE,
drawx = FALSE,
drawblob = FALSE,
blobres = NULL,
blobsmooth = NULL,
outline = FALSE,
ci = c(0.5, 0.95),
lwd = 1,
mean = FALSE,
link = FALSE,
linklwd = 1,
labels = FALSE,
labelpos = NULL,
labelcex = 0.7,
whichx = NULL,
rowx = NULL,
columnx = NULL,
whichy = NULL,
rowy = NULL,
columny = NULL,
xlab = NULL,
ylab = NULL,
main = NULL,
xlim = NULL,
ylim = NULL,
transformx = c("none", "exp", "expit"),
transformy = c("none", "exp", "expit"),
add = FALSE,
...
)
Arguments
dfx |
Output object returned from |
dfy |
Optionally, a
two-dimensional |
p |
Vector of parameter names, if input to |
col |
Color for plotting, or recyclable vector of colors. Defaults to |
drawcross |
Whether to draw quantile bars in the x- and y-directions.
Defaults to |
drawx |
Whether to draw quantile bars along the standardized principal component axes.
Defaults to |
drawblob |
Whether to draw smoothed quantile polygons.
Defaults to |
blobres |
Optional tuning parameter for drawing quantile polygons, and
corresponds to the number of polygon vertices. If the default |
blobsmooth |
Optional tuning parameter for drawing quantile polygons, and
corresponds to half the number of polygon vertices used for local smoothing.
If the default |
outline |
Whether to draw quantile polygons as lines rather than filled regions. Defaults to |
ci |
Vector of intervals to overlay. Defaults to 50 percent and 95 percent. |
lwd |
Base line width for plotting. Defaults to 1. |
mean |
Whether to include points for means. Defaults to |
link |
Whether to link medians in sequence. Defaults to |
linklwd |
Line width to use for linking. Defaults to |
labels |
Whether to add labels, or a vector of labels to add. Defaults to |
labelpos |
Optionally, an argument to |
labelcex |
Optional character expansion for labels. Defaults to |
whichx |
Element to subset for x, if only one element of a vector of parameter nodes is desired for plotting. |
rowx |
Row to subset for x, in the case of a 2-d matrix of parameter nodes in-model. |
columnx |
Column to subset for x, in the case of a 2-d matrix of parameter nodes in-model. |
whichy |
Element to subset for x, if only one element of a vector of parameter nodes is desired for plotting. |
rowy |
Row to subset for y, in the case of a 2-d matrix of parameter nodes in-model. |
columny |
Column to subset for y, in the case of a 2-d matrix of parameter nodes in-model. |
xlab |
X-axis label. If the default |
ylab |
Y-axis label. If the default |
main |
Plot title. |
xlim |
X-axis limits. If the default ( |
ylim |
Y-axis limits. If the default ( |
transformx |
Should the x-axis be (back)transformed? Options are |
transformy |
Should the y-axis be (back)transformed? Options are |
add |
Whether to add to existing plot |
... |
additional plotting arguments |
Value
NULL
Author(s)
Matt Tyers
See Also
Examples
## basic functionality with cross geometry
crossplot(SS_out, p=c("trend","rate"))
## default labels
crossplot(SS_out, p=c("trend","cycle"), labels=TRUE)
## showing:
## - link lines
## - blob geometry (smoothed confidence polygons)
## - random colors with col="random"
crossplot(SS_out, p=c("trend","cycle"),
labels=SS_data$x, labelpos=1, link=TRUE, drawblob=TRUE,
col="random")
## adding x geometry and showing usage with a single vector element (41)
crossplot(SS_out, p=c("trend","cycle"),
whichx=41, whichy=41,
drawblob=TRUE, drawx=TRUE)
## single vectors (or data.frames or 2d matrices) can also be used
xx <- SS_out$sims.list$trend[,41]
yy <- SS_out$sims.list$cycle[,41]
par(mfrow = c(2, 2))
plot(xx, yy, col=adjustcolor(1, alpha.f=.1), pch=16, main="cross geometry")
crossplot(xx, yy, add=TRUE, col=1)
plot(xx, yy, col=adjustcolor(1, alpha.f=.1), pch=16, main="x geometry")
crossplot(xx, yy, add=TRUE, col=1,
drawcross=FALSE, drawx=TRUE)
plot(xx, yy, col=adjustcolor(1, alpha.f=.1), pch=16, main="blob geometry")
crossplot(xx, yy, add=TRUE, col=1,
drawcross=FALSE, drawblob=TRUE)
plot(xx, yy, col=adjustcolor(1, alpha.f=.1), pch=16, main="blob outlines")
crossplot(xx, yy, add=TRUE, col=1,
drawcross=FALSE, drawblob=TRUE, outline=TRUE)