log.hist {HyperbolicDist} | R Documentation |
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.
log.hist(x, breaks = "Sturges", include.lowest = TRUE, right = TRUE, main = paste("Log-Histogram of", xname), xlim = range(breaks), ylim = NULL, xlab = xname, ylab = "Log Density", nclass = NULL, ...)
x |
a vector of values for which the log-histogram is desired |
breaks |
one of:
|
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 log-hist, see Details |
nclass |
numeric (integer). For compatibility with hist only,
nclass is equivalent to breaks for a scalar or
character argument. |
... |
further graphical parameters for call to plot . |
Based on hist.default
. The code to create cells or
classes and calculate counts and the density has been taken directly
from hist.default
. The option of graphing frequencies (or counts)
present in hist
is not allowed here, so that part of the
hist.default
code has been commented out.
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.
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. |
log.density |
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. |
ylim |
the value of ylim calculated by log.hist . |
David Scott d.scott@auckland.ac.nz, Ai-Wei Lee, Jennifer Tso, Richard Trendall
Barndorff-Nielsen, O. (1977) Exponentially decreasing distributions for the logarithm of particle size, Proc. Roy. Soc. Lond., A353, 401–419.
Barndorff-Nielsen, O. and Blaesild, 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.
data(SandP500) ## Consider proportional changes in the index change<-SandP500[-length(SandP500)]/SandP500[-1] hist(change) log.hist(change) ## Fit the hyperbolic distribution to the changes fit.hyperb(change)