comparedens {jagshelper}R Documentation

Compare Density

Description

Side-by-side kernel density plots for all parameters (or a specified subset) from two jagsUI output objects or data.frames. The intent of this function is easy comparison of inferences from two comparable models.

Kernel densities are plotted vertically, either left- or right-facing. Parameters with the same name are plotted facing one another.

Usage

comparedens(
  x1,
  x2,
  p = NULL,
  minCI = 0.99,
  ylim = NULL,
  legendnames = NULL,
  legendpos = "topleft",
  col = c(4, 2),
  ...
)

Arguments

x1

Output object returned from jagsUI; or alternately a data.frame

x2

Second output object returned from jagsUI; or alternately a data.frame

p

Optional vector of parameters to subset. All parameters with names matching the beginning of the string supplied will be returned. If the default (NULL) is accepted, all parameters will be plotted.

minCI

Minimum CI width for plotting. This is intended as a method for excluding far-outlying MCMC samples when determining the appropriate y-axis limits for plotting. Defaults to 99%.

ylim

Y-axis limits for plotting. If the default (NULL) is accepted, limits will be automatically determined.

legendnames

Names for optional legend. If the default NULL is accepted, no legend will be drawn.

legendpos

Position for optional legend. Defaults to "topleft".

col

Colors for kernel density plots. Defaults to colors 4 and 2 (blue and red).

...

additional plotting arguments

Value

NULL

Author(s)

Matt Tyers

See Also

comparecat, comparepriors

Examples

## This is the same output object twice, but shows functionality.
comparedens(x1=asdf_jags_out, x2=asdf_jags_out, p=c("a","b","sig"),
            legendnames=c("Model 1", "Model 2"))

[Package jagshelper version 0.3.1 Index]