
Last chance! 50% off unlimited learning
Sale ends in
[dpqr]gh
The generalized hyperbolic distribution,
[dpqr]hyp
The hyperbolic distribution,
hypMode
the hyperbolic mode,
[dpqr]nig
The normal inverse Gaussian distribution,
hypSlider
interactive hyperbolic distribution display,
nigSlider
interactive NIG distribution display. }dgh(x, alpha = 1, beta = 0, delta = 1, mu = 0, lambda = 1)
pgh(q, alpha = 1, beta = 0, delta = 1, mu = 0, lambda = 1)
qgh(p, alpha = 1, beta = 0, delta = 1, mu = 0, lambda = 1)
rgh(n, alpha = 1, beta = 0, delta = 1, mu = 0, lambda = 1)
dhyp(x, alpha = 1, beta = 0, delta = 1, mu = 0, pm = c(1, 2, 3, 4))
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))
hypMode(alpha = 1, beta = 0, delta = 1, mu = 0, pm = c(1, 2, 3, 4))
dnig(x, alpha = 1, beta = 0, delta = 1, mu = 0)
pnig(q, alpha = 1, beta = 0, delta = 1, mu = 0)
qnig(p, alpha = 1, beta = 0, delta = 1, mu = 0)
rnig(n, alpha = 1, beta = 0, delta = 1, mu = 0)
hypSlider()
nigSlider()
alpha
;
skewness parameter beta
, abs(beta)
is in the
range (0, alpha);
scale parameter delta
, delta
must be zero or
positive;
l1
and 4
for the
selection of the parameterization. The default takes the
first parameterization.integrate
.*gh
, *hyp
, and *nig
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.
The function hyp*Mode
returns the mode in the appropriate
parameterization. A numeric value.
The functions hypSlider
and nigSlider
display for educational purposes the densities and probabilities
of the hyperbolic and normal inverse Gaussian distributions.rgh
is based on the GH algorithm given
by Scott (2004).
Hyperbolic Distibution:
The generator rhyp
is based on the HYP algorithm given
by Atkinson (1982).
Normal Inverse Gaussian Distribution:
The random deviates are calculated with the method described by
Raible (2000).## SOURCE("fBasics.13B-HyperbolicDistribution")
## hyp -
xmpBasics("Start: Hyperbolic Distribution > ")
par(mfcol = c(3, 2), cex = 0.5)
set.seed(1953)
r = rhyp(1000, alpha = 1, beta = 0.3, delta = 1)
plot(r, type = "l", col = "steelblue4",
main = "hyp: alpha=1 beta=0.3 delta=1")
# Plot empirical density and compare with true density:
hist(r, n = 25, probability = TRUE, border = "white", col = "steelblue4")
x = seq(-5, 5, 0.25)
lines(x, dhyp(x, alpha = 1, beta = 0.3, delta = 1))
# Plot df and compare with true df:
plot(sort(r), (1:1000/1000), main = "Probability", col = "steelblue4")
lines(x, phyp(x, alpha = 1, beta = 0.3, delta = 1))
# Compute quantiles:
qhyp(phyp(seq(-5, 7, 1), alpha = 1, beta = 0.3, delta = 1),
alpha = 1, beta = 0.3, delta = 1)
# Compute the mode:
hypMode(alpha = 1, beta = 0.3, delta = 1)
## nig -
xmpBasics("Next: Normal Inverse Gaussian Distribution > ")
set.seed(1953)
r = rnig(5000, alpha = 1, beta = 0.3, delta = 1)
plot(r, type = "l", col = "steelblue4",
main = "nig: alpha=1 beta=0.3 delta=1")
# Plot empirical density and compare with true density:
hist(r, n = 25, probability = TRUE, border = "white", col = "steelblue4")
x = seq(-5, 5, 0.25)
lines(x, dnig(x, alpha = 1, beta = 0.3, delta = 1))
# Plot df and compare with true df:
plot(sort(r), (1:5000/5000), main = "Probability", col = "steelblue4")
lines(x, pnig(x, alpha = 1, beta = 0.3, delta = 1))
# Compute Quantiles:
qnig(pnig(seq(-5, 5, 1), alpha = 1, beta = 0.3, delta = 1),
alpha = 1, beta = 0.3, delta = 1)
Run the code above in your browser using DataLab