dhyperb {HyperbolicDist} | R Documentation |
Density function, distribution function, quantiles and
random number generation for the hyperbolic distribution
with parameter vector theta
.
dhyperb(x, theta, K.nu=NULL, log.pars=FALSE) phyperb(q, theta, tol=10^(-5), subdivisions=100) qhyperb(p, theta, tol=10^(-5), n.interpol=100, subdivisions=100, ...) rhyperb(n, theta)
x,q |
vector of quantiles |
p |
vector of probabilities |
n |
number of observations to be generated |
theta |
parameter vector taking the form c(pi,zeta,delta,mu) |
K.nu |
sets the value of the Bessel function in the density. See Details |
log.pars |
logical; if TRUE the second and third components
of theta are taken to be log(zeta) and log(delta) respectively |
tol |
an upper bound on the error in the distribution function. See Details |
subdivisions |
the maximum number of subdivisions used to integrate the density returning the distribution function |
n.interpol |
the number of points used in qhyperb for cubic spline
interpolation (see splinefun ) of the distribution function |
... |
passes arguments to uniroot . See Details |
The hyperbolic distribution has density
f(x)=1/(2 sqrt(1+pi^2) K_1(zeta)) exp(-zeta(sqrt(1+pi^2) sqrt(1+((x-mu)/delta)^2)-pi (x-mu)/delta))
where
K_1()
is the modified Bessel function of the third kind with order 1.
A succinct description of the hyperbolic distribution is given in Barndorff-Nielsen and Blaesild (1983). Three different possible parameterisations are described in that paper. All use location and scale parameters mu and delta. There are two other parameters in each case.
Use hyperb.change.pars
to convert from the alpha/beta or phi/gamma
parameterisations to the parameterisation (pi/zeta) used above.
phyperb
uses a numerical integration routine (integrate()
)
to integrate the density dhyperb
. See the notes on integrate
for the shortfalls of this procedure. In particular note the weakness of
this function when integrating over a region that is approximately zero.
qhyperb
uses splinefun
on values generated by pyhyperb
to approximate the distribution function. The quantiles are then found
using the uniroot
function.
rhyperb
is based on the HYP algorithm given by Atkinson (1982).
dhyperb
gives the density, phyperb
gives the distribution
function, qhyperb
gives the quantile function and rhyperb
generates random variates.
David Scott d.scott@auckland.ac.nz, Ai-Wei Lee, Jennifer Tso, Richard Trendall
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. 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.
integrate
for its shortfalls, splinefun
,
uniroot
and hyperb.change.pars
for
changing parameters to the pi/zeta parameterisation
theta <- c(0,1,1,0) data.vector <- rhyperb(500,theta) par(mfrow=c(1,2)) hist(data.vector,freq=FALSE) curve(dhyperb(x,theta),add=TRUE, range(data.vector)[1],range(data.vector)[2]) log.hist(data.vector) curve(log(dhyperb(x,theta)),add=TRUE, range(data.vector)[1],range(data.vector)[2]) hyperb.range <- calculate.range(c(0,1,1,0),tol=10^(-2)) curve(dhyperb(x,theta), hyperb.range[1],hyperb.range[2],log="") title("Density of the\n Hyperbolic Distribution") curve(phyperb(x,theta), hyperb.range[1],hyperb.range[2],log="") title("Distribution Function of the\n Hyperbolic Distribution")