hyp {fBasics} | R Documentation |
Density, distribution function, quantile function and random generation for the hyperbolic distribution.
dhyp(x, alpha = 1, beta = 0, delta = 1, mu = 0, pm = c("1", "2", "3", "4"), log = FALSE) phyp(q, alpha = 1, beta = 0, delta = 1, mu = 0, pm = c("1", "2", "3", "4"), ...) qhyp(p, alpha = 1, beta = 0, delta = 1, mu = 0, pm = c("1", "2", "3", "4"), ...) rhyp(n, alpha = 1, beta = 0, delta = 1, mu = 0, pm = c("1", "2", "3", "4"))
alpha, beta, delta, mu |
shape parameter |
n |
number of observations. |
p |
a numeric vector of probabilities. |
pm |
an integer value between |
x, q |
a numeric vector of quantiles. |
log |
a logical, if TRUE, probabilities |
... |
arguments to be passed to the function |
The generator rhyp
is based on the HYP algorithm given
by Atkinson (1982).
All values for the *hyp
functions are numeric vectors:
d*
returns the density,
p*
returns the distribution function,
q*
returns the quantile function, and
r*
generates random deviates.
All values have attributes named "param"
listing
the values of the distributional parameters.
David Scott for code implemented from R's
contributed package HyperbolicDist
.
Atkinson, A.C. (1982); The simulation of generalized inverse Gaussian and hyperbolic random variables, SIAM J. Sci. Stat. Comput. 3, 502–515.
Barndorff-Nielsen O. (1977); Exponentially decreasing distributions for the logarithm of particle size, Proc. Roy. Soc. Lond., A353, 401–419.
Barndorff-Nielsen O., 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.
Raible S. (2000); Levy Processes in Finance: Theory, Numerics and Empirical Facts, PhD Thesis, University of Freiburg, Germany, 161 pages.
## hyp - set.seed(1953) r = rhyp(5000, alpha = 1, beta = 0.3, delta = 1) plot(r, type = "l", col = "steelblue", main = "hyp: alpha=1 beta=0.3 delta=1") ## hyp - # Plot empirical density and compare with true density: hist(r, n = 25, probability = TRUE, border = "white", col = "steelblue") x = seq(-5, 5, 0.25) lines(x, dhyp(x, alpha = 1, beta = 0.3, delta = 1)) ## hyp - # Plot df and compare with true df: plot(sort(r), (1:5000/5000), main = "Probability", col = "steelblue") lines(x, phyp(x, alpha = 1, beta = 0.3, delta = 1)) ## hyp - # Compute Quantiles: qhyp(phyp(seq(-5, 5, 1), alpha = 1, beta = 0.3, delta = 1), alpha = 1, beta = 0.3, delta = 1)