Description Usage Arguments Details Author(s) References Examples
mlplot plots the scalar components as of the given random array or
vector as horizontal intervals, grouped by row.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | mlplot(X, ...)
## Default S3 method:
mlplot(
X,
y.center = TRUE,
y.shift = 0,
y.map = NULL,
mar = par("mar"),
left.margin = 3,
vline = NULL,
top.axis = TRUE,
exp.labels = FALSE,
x.ticks = NULL,
axes = NULL,
xlim = NULL,
ylim = NULL,
xlab = deparse(substitute(X)),
ylab = NULL,
las = NULL,
add = FALSE,
...
)
|
X |
a random array or vector |
... |
further arguments passed to plot and points |
y.center |
center the intervals nicely at each y-coordinate? |
y.shift |
add this amount to each y coordinate of an interval |
y.map |
optional function to compute the y-coordinates, given |
mar |
the margins of the plot |
left.margin |
offset to add to the left margin of the plot (to add space for the labels) |
vline |
if numeric, plot vertical lines at these (horizontal) coordinates |
top.axis |
(logical) plot the top axis? |
exp.labels |
(logical) if the original scale is logarithmic, label ticks in original (exp) scale? |
x.ticks |
positions for the ticks of the x-axis |
axes |
(logical) plot the axes at all? |
xlim |
x limits |
ylim |
y limits |
xlab |
x label |
ylab |
not used (instead of labels, the row names are shown) |
las |
the style of axis labels, see |
add |
(logical) add the intervals to an existing plot? |
mlplot plots the scalar components of a vector or an array (2 or
3-dimensional) vertically (up to down) so that a component of a vector or a
row of a matrix is plotted at vertical points 1...nrow(x).
An 'mlplot' of a vector implements a "forest plot."
Scalars on the same row are plotted closely together. The positioning of
the scalars within a row are controlled by the arguments y.center,
y.shift, y.map. These do not need to be set for the default
plot; if two arrays or vectors are plotted over on top of each other (using
add=TRUE) then you should probably change y.shift which
controls the vertical position of the array elements.
See demo(mlplot) for a detailed
To change the color of the random components of the vector, use
rvcol. Typically this is of the same length as X, giving the
color ‘theme’ for each component.
If X is a 3-dimensional array, mlplot is called repeatedly for
each 2-dimensional array X[,,k] for each k.
X may also be a fixed numeric object.
NAs (or random scalars with 100\
mlplot is still experimental.
Jouni Kerman jouni@kerman.com
Kerman, J. and Gelman, A. (2007). Manipulating and Summarizing Posterior Simulations Using Random Variable Objects. Statistics and Computing 17:3, 235-244.
See also vignette("rv").
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ## Not run:
# You can run this complete example by typing demo("mlplot")
n.rows <- 4; n.cols <- 5; n <- (n.rows*n.cols)
# Draw some fixed numbers
mu.true <- rnorm(1:n.rows, mean=1:n.rows, sd=1)
sigma.true <- 1
theta <- rvmatrix(rvnorm(n=n.cols, mean=mu.true, sd=sigma.true), nrow=n.rows)
#
col.labels <- paste("Time", 1:n.cols, sep=":")
row.labels <- paste("Unit", 1:n.rows, sep=":")
dimnames(theta) <- list(row.labels, col.labels)
#
par(mfrow=c(2,2))
mlplot(theta, main="theta")
abline(v=0, lty="dotted")
mlplot(t(theta), main="theta transposed")
abline(v=0, lty="dotted")
row.sd <- apply.rv(theta, 1, sd.rv)
col.sd <- apply.rv(theta, 2, sd.rv)
x.max <- max(rvquantile(c(row.sd, col.sd), 0.99))
mlplot(row.sd, xlim=c(0, x.max), main="theta: within-row sd for each unit")
abline(v=0)
mlplot(col.sd, xlim=c(0, x.max), main="theta: between-row sd for each time point")
abline(v=0)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.