if (FALSE) {
mu <- 4; rho2 <- 0.4 * 2; x <- seq(-0.5, 2*pi+0.5, len = 1001)
plot(x, dcard2(x, mu, rho2), type = "l", las = 1, ylim = 0:1,
ylab = paste0("[dp]card2(mu=", mu, ", rho2=", rho2, ")"),
main = "Blue is density, orange the CDF", col = "blue",
sub = "Purple lines are the 10,20,...,90 percentiles")
lines(x, pcard2(x, mu, rho2), col = "orange")
probs <- seq(0, 1, by = 0.1)
Q <- qcard2(probs, mu, rho2)
lines(Q, dcard2(Q, mu, rho2), col = 3, lty = 3, type = "h")
lines(Q, pcard2(Q, mu, rho2), col = 3, lty = 3, type = "h")
abline(h = probs, v = c(0, 2*pi), col = 3, lty = 3)
max(abs(pcard2(Q, mu, rho2) - probs)) # Should be 0
}
Run the code above in your browser using DataLab