Learn R Programming

Boom (version 0.9.15)

compare.many.ts: Compares several density estimates.

Description

Produce a plot that compares the kernel density estimates for each element in a series of Monte Carlo draws of a vector or matrix.

Usage

CompareManyTs(list.of.ts, burn = 0, type = "l", gap = 0,
              boxes = TRUE, thin = 1, labels = NULL,
              same.scale = TRUE, ylim = NULL, refline = NULL,
              color = NULL, ...)

Arguments

list.of.ts

A list of time series matrices, data.frames or 3-dimensional arrays, all of the same size. The list elements correspond to groups. The first index of the array in each list element corresponds to time. The subsequent indices correspond to variables to be plotted.

burn

The number of initial observations to be discarded as burn-in (when plotting MCMC output).

type

The plotting type to use when plotting the time series. See plot.

gap

The amount of space to put between plots.

boxes

Logical. Should boxes be drawn around the plots?

thin

Plot every thin'th observation. This can reduce the amount of time it takes to make the plot if there are many long time series.

labels

A character vector to use as labels for individual plots.

same.scale

Logical. If TRUE then all plots are shown on the same verical scale, and vertical axes are drawn. If FALSE then each plot gets its own scale.

ylim

The scale of the vertical axis. If non-NULL then same.scale will be set to TRUE.

refline

The scalar value at which a thin dotted horizontal line should be plotted in each panel. This is useful for highlighting zero, for example.

color

A vector of colors to use for the plots.

...

Extra arguments passed to 'plot' and 'axis'.

Author

Steven L. Scott

See Also

PlotManyTs, CompareManyDensities

Examples

Run this code
x <- array(rnorm(9000), dim = c(1000, 3, 3))
dimnames(x) <- list(NULL, c("Larry", "Moe", "Curly"), c("Larry", "Eric", "Sergey"))
y <- array(rnorm(9000), dim = c(1000, 3, 3))
z <- array(rnorm(9000), dim = c(1000, 3, 3))
data <- list(x = x, y = y, z = z)
CompareManyTs(data, color = c("red", "blue", "green"))

x <- matrix(rnorm(5000), nrow = 1000)
colnames(x) <- c("Larry", "Moe", "Curly", "Shemp", "???")
y <- matrix(rnorm(5000), nrow = 1000)
z <- matrix(rnorm(5000), nrow = 1000)
data <- list(x = x, y = y, z = z)
CompareManyTs(data, color = c("red", "blue", "green"))

Run the code above in your browser using DataLab