Trellis of Histograms

Usage

histplot(formula, data, 
prepanel = prepanel.histplot, panel = panel.histplot, 
nbins = 5, h, x0 = -h/1000, breaks, prob = T, 
aspect = "fill", ...)

Arguments

formula a formula in the form: ~ x | g1 * g2 * ...{} where the given variables g1, g2, ...{} may be omitted. The x variable is a numeric response and is the data used to construct each histogram. Variables on the right hand side of the vertical bar are factors or shingles, and are used to parcel the x values out to various panels. If there are no given variables the initial ~ may be omitted.
data A data frame as list against which to evaluate the formula.
prepanel The prepanel function to be used.
panel The panel function to be used.
nbins The suggested number of bins. The default is small, as the number of data points in each panel is unknown at this stage.
h The width of the bins.
x0 A shift for the bin sequence - the breakpoints are at x0 + n * h.
breaks The set of breakpoints to be used. (Usually omitted).
prob If true (the default) plot a true histogram. The vertical axis has a relative frequency density scale, so the product of the dimensions of any panel gives the relative frequency. Hence the total area under the histogram is 1 and it is directly comparable with most other estimates of the probability density function. If false plot the counts in the bins.
... generic Trellis arguments. See under trellis.args for details.

Description

Plot a trellis of histograms of data.

Details

If breaks is specified, those breakpoints are used. Otherwise if h is specified, a regular grid of bins is used with width h. If neither breaks nor h is specified, nbins is used to select a suitable h. Beware of using bandwidth selection algorithms to choose h, as the data will be split, possibly unevenly, across panels.

Attempts to use unequally spaced breaks with prob=F will be honoured with a warning, but this is strongly discouraged as misleading.

Value

an object of class trellis, which is automatically plotted by print.trellis.

See Also

truehist, histogram, trellis.args


[Package Contents]