## theoretical probabilities for a Sinh-Arcsinh distribution
## with mu = 0, sigma = 1, nu = 1, tau = 1 (default) the Sinh-Arcsinh distribution
## corresponds to the standard normal distribution
x <- seq(-5, 5, by = 0.1)
p <- dsinharcsinh(x)
plot(x, p, type = "l", lwd = 2)
lines(x, dnorm(x), col = 2, lty = 2, lwd = 2)
## corresponding empirical frequencies from a simulated sample
## with mu = 5, sigma = 3, nu = 0.7, tau = 0.7
set.seed(0)
y <- rsinharcsinh(500, mu = 5, sigma = 3, nu = 1.1, tau = 0.7)
hist(y)
## the quantile function is the inverse of the distribution function
psinharcsinh(qsinharcsinh(0.7))
qsinharcsinh(psinharcsinh(3))
## inversion using custom parameters mu = 5, sigma = 2, nu = 0.7, tau = 1.3
psinharcsinh(qsinharcsinh(0.7, 5, 2, 0.7, 1.3), 5, 2, 0.7, 1.3)
qsinharcsinh(psinharcsinh(3, 5, 2, 0.7, 1.3), 5, 2, 0.7, 1.3)
Run the code above in your browser using DataLab