Learn R Programming

expert (version 1.0-0)

hist.expert: Histogram of the Expert Aggregated Distribution

Description

This method for the generic function hist is mainly useful to plot the histogram of objects of class "expert". If plot = FALSE, the resulting object of class "histogram" is returned for compatibility with hist.default, but does not contain much information not already in x.

Usage

"hist"(x, freq = NULL, probability = !freq, density = NULL, angle = 45, col = NULL, border = NULL, main = paste("Histogram of" , xname), xlim = NULL, ylim = NULL, xlab = "x", ylab = expression(f(x)), axes = TRUE, plot = TRUE, labels = FALSE, ...)

Arguments

x
an object of class "expert"
freq
logical; if TRUE, the histogram graphic is a representation of frequencies, the counts component of the result; if FALSE, probability densities, component density, are plotted (so that the histogram has a total area of one). Defaults to TRUE iff group boundaries are equidistant (and probability is not specified).
probability
an alias for !freq, for S compatibility.
density
the density of shading lines, in lines per inch. The default value of NULL means that no shading lines are drawn. Non-positive values of density also inhibit the drawing of shading lines.
angle
the slope of shading lines, given as an angle in degrees (counter-clockwise).
col
a colour to be used to fill the bars. The default of NULL yields unfilled bars.
border
the color of the border around the bars. The default is to use the standard foreground color.
main, xlab, ylab
these arguments to title have useful defaults here.
xlim, ylim
the range of x and y values with sensible defaults. Note that xlim is not used to define the histogram (breaks), but only for plotting (when plot = TRUE).
axes
logical. If TRUE (default), axes are draw if the plot is drawn.
plot
logical. If TRUE (default), a histogram is plotted, otherwise a list of breaks and counts is returned.
labels
logical or character. Additionally draw labels on top of bars, if not FALSE; see plot.histogram.
...
further graphical parameters passed to plot.histogram and their to title and axis (if plot=TRUE).

Value

An object of class "histogram" which is a list with components:
breaks
the $r + 1$ group boundaries.
counts
$r$ integers; the frequency within each group.
density
the relative frequencies within each group $n[j]/n$, where $n[j]$ = counts[j].
intensities
same as density. Deprecated, but retained for compatibility.
mids
the $r$ group midpoints.
xname
a character string with the actual x argument name.
equidist
logical, indicating if the distances between breaks are all the same.

References

Klugman, S. A., Panjer, H. H. and Willmot, G. E. (1998), Loss Models, From Data to Decisions, Wiley.

See Also

hist and hist.default for histograms of individual data and fancy examples.

Examples

Run this code
x <- list(E1 <- list(A1 <- c(0.14, 0.22, 0.28),
                     A2 <- c(130000, 150000, 200000),
                     X <- c(350000, 400000, 525000)),
          E2 <- list(A1 <- c(0.2, 0.3, 0.4),
                     A2 <- c(165000, 205000, 250000),
                     X <- c(550000, 600000, 650000)),
          E3 <- list(A1 <- c(0.2, 0.4, 0.52),
                     A2 <- c(200000, 400000, 500000),
                     X <- c(625000, 700000, 800000)))
probs <- c(0.1, 0.5, 0.9)
true.seed <- c(0.27, 210000)
fit <- expert(x, "cooke", probs, true.seed, 0.03)
hist(fit)

Run the code above in your browser using DataLab