## 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, 7, 0.2)
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)
## 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.1)
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, 7, 1), alpha = 1, beta = 0.3, delta = 1),
alpha = 1, beta = 0.3, delta = 1)
Run the code above in your browser using DataLab