Plots a log-histogram, as in for example Feiller, Flenley and Olbricht
(1992).
The intended use of the log-histogram is to examine the fit of a
particular density to a set of data, as an alternative to a histogram
with a density curve. For this reason, only the log-density histogram
is implemented, and it is not possible to obtain a log-frequency
histogram.
The log-histogram can be plotted with histogram-like dashed vertical
bars, or as points marking the tops of the log-histogram bars, or with
both bars and points.
A vector of values for which the log-histogram is desired.
breaks
One of:
a vector giving the breakpoints between log-histogram cells;
a single number giving the number of cells for the log-histogram;
a character string naming an algorithm to compute the
number of cells (see Details);
a function to compute the number of cells.
In the last three cases the number is a suggestion only.
include.lowest
Logical. If TRUE,
an ‘x[i]’ equal to the ‘breaks’ value will be included in the first
(or last, for right = FALSE) bar.
right
Logical. If TRUE, the log-histograms cells are
right-closed (left open) intervals.
main, xlab, ylab
These arguments to title have useful
defaults here.
xlim
Sensible default for the range of x values.
ylim
Calculated by logHist, see Details.
nclass
Numeric (integer). For compatibility with hist only,
nclass is equivalent to breaks for a scalar or
character argument.
htype
Type of histogram. Possible types are:
'"h"' for a *h*istogram only;
'"p"' for *p*oints marking the top of the histogram bars only;
'"b"' for *b*oth.
...
Further graphical parameters for calls
to plot and points.
Details
Uses hist.default to determine the cells or classes and
calculate counts.
To calculate ylim the following procedure is used. The upper
end of the range is given by the maximum value of the log-density,
plus 25% of the absolute value of the maximum. The lower end of the
range is given by the smallest (finite) value of the log-density, less
25% of the difference between the largest and smallest (finite) values
of the log-density.
A log-histogram in the form used by Feiller, Flenley and Olbricht (1992)
is plotted. See also Barndorff-Nielsen (1977) for use of log-histograms.
Value
Returns a list with components:
breaks
The n+1 cell boundaries (= breaks if that
was a vector).
counts
n integers; for each cell, the number of
x[] inside.
logDensity
Log of f^(x[i]), which are estimated
density values.
If all(diff(breaks) == 1), estimated density values are the
relative frequencies counts/n and in general satisfy
sum[i; f^(x[i])
(b[i+1]-b[i])] = 1, where b[i] = breaks[i].
mids
The n cell midpoints.
xName
A character string with the actual x argument name.
heights
The location of the tops of the vertical segments used
in drawing the log-histogram.
Barndorff-Nielsen, O. (1977)
Exponentially decreasing distributions for the logarithm of particle size,
Proc. Roy. Soc. Lond.,
A353, 401–419.
Barndorff-Nielsen, O. and Bl<c3><a6>sild, P (1983).
Hyperbolic distributions.
In Encyclopedia of Statistical Sciences,
eds., Johnson, N. L., Kotz, S. and Read, C. B., Vol. 3,
pp. 700–707. New York: Wiley.
Fieller, N. J., Flenley, E. C. and Olbricht, W. (1992)
Statistics of particle size data.
Appl. Statist.,
41, 127–146.
See Also
hist
Examples
x <- rnorm(200)
hist(x)
### default
logHist(x)
### log histogram only
logHist(x, htype = "h")
### points only, some options
logHist(x, htype = "p", pch = 20, cex = 2, col = "steelblue")
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(DistributionUtils)
Loading required package: RUnit
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/DistributionUtils/logHist.Rd_%03d_medium.png", width=480, height=480)
> ### Name: logHist
> ### Title: Plot Log-Histogram
> ### Aliases: logHist
> ### Keywords: hplot distribution
>
> ### ** Examples
>
> x <- rnorm(200)
> hist(x)
> ### default
> logHist(x)
> ### log histogram only
> logHist(x, htype = "h")
> ### points only, some options
> logHist(x, htype = "p", pch = 20, cex = 2, col = "steelblue")
>
>
>
>
>
> dev.off()
null device
1
>