x <- seq(-5, 5, by = 0.01)
loc <- 0; sigma <- 1.5; kappa <- 2
plot(x, dalap(x, loc, sigma, kappa = kappa), type = "l", col = "blue",
main = "Blue is density, red is cumulative distribution function",
ylim = c(0,1), sub = "Purple are 5, 10, ..., 95 percentiles",
las = 1, ylab = "", cex.main = 0.5)
abline(h = 0, col = "blue", lty = 2)
lines(qalap(seq(0.05, 0.95, by = 0.05), loc, sigma, kappa = kappa),
dalap(qalap(seq(0.05, 0.95, by = 0.05), loc, sigma, kappa = kappa),
loc, sigma, kappa = kappa), col = "purple", lty = 3, type = "h")
lines(x, palap(x, loc, sigma, kappa = kappa), type = "l", col = "red")
abline(h = 0, lty = 2)
pp = seq(0.05, 0.95, by = 0.05) # Test two functions
max(abs(palap(qalap(pp, loc, sigma, kappa = kappa),
loc, sigma, kappa = kappa) - pp)) # Should be 0
Run the code above in your browser using DataLab