The density strip illustrates a univariate distribution as a shaded
rectangular strip, whose darkness at a point is proportional to the
probability density. The strip is darkest at the maximum density and
fades into the background at the minimum density. It may be used to generalise
the common point-and-line drawing of a point and interval estimate,
by representing the entire posterior or predictive distribution of the
estimate. This function adds a density strip to an existing plot.
Either the vector of points at which the density is
evaluated (if dens supplied), or a sample from the distribution
(if dens not supplied).
dens
Density at x. If dens is not supplied,
the density of the sample x is estimated by kernel density
estimation, using density(x,...).
at
Position of the centre of the strip on the y-axis (if
horiz=TRUE) or the x-axis (if horiz=FALSE).
width
Thickness of the strip, that is, the length of its
shorter dimension. Defaults to 1/30 of the axis range.
horiz
Draw the strip horizontally (TRUE) or vertically (FALSE).
colmax
Colour at the maximum density, either as a built-in R
colour name (one of colors()) or an RGB hex
value. Defaults to par("fg") which is normally
"black", or "#000000". Or in lattice, defaults
to trellis.par.get("add.line")$col.
colmin
Colour to shade the minimum density, likewise.
Defaults to "white". If this is set to "transparent",
and the current graphics device supports transparency (see rgb), then
overlapping strips will merge smoothly.
scale
Proportion of colmax to shade the maximum
density, for example scale=0.5 with colmax="black" for
a mid-grey colour.
gamma
Gamma correction to apply to the colour palette.
The default of 1 should give an approximate perception of
darkness proportional to density, but this may need to be adjusted
for different displays. Values of gamma greater than 1
produce colours weighted towards the lighter end, and values of
between 0 and 1 produce darker colours.
ticks
Vector of x-positions on the strip to draw tick marks, or NULL for no ticks.
tlen
Length of these tick marks relative to the strip width.
twd
Line thickness of these marks (defaults to
par("lwd"), or in lattice, to
trellis.par.get("add.line")$lwd*2.).
tcol
Colour of the tick marks. Defaults to colmax.
mticks
x-position to draw a thicker tick mark or tick
marks (for example, at the mean or median).
mlen
Length of this mark relative to the strip width.
mwd
Line thickness of this mark (defaults to
par("lwd")*2, or in lattice, to
trellis.par.get("add.line")$lwd*2.).
mcol
Colour of this mark. Defaults to colmax.
lattice
Set this to TRUE to make denstrip
a lattice panel function instead of a base graphics function. panel.denstrip(x,...) is equivalent to
denstrip(x, lattice=TRUE, ...).
...
Additional arguments supplied to density(x,...), if
the density is being estimated. For example, bw to change
the bandwidth of the kernel.
In other software
An add-on which enables the WinBUGS 1.4 software for Bayesian analysis to
draw density strips is available from
http://www.mrc-bsu.cam.ac.uk/personal/chris/papers/denstrip_wbpatch.txt. Open
this file in WinBUGS and select Tools->Decode->Decode All.
They will then be available via the Inference/Compare menu.
In OpenBUGS (http://www.openbugs.info) density strips are
available via the Inference/Compare menu.