a <- 3; x <- seq(-0.5, 3, len = 100)
plot(x, dmaxwell(x, a = a), type = "l", col = "blue", las = 1, ylab = "",
main = "Blue is density, orange is cumulative distribution function",
sub = "Purple lines are the 10,20,...,90 percentiles")
abline(h = 0, col = "blue", lty = 2)
lines(x, pmaxwell(x, a = a), type = "l", col = "orange")
probs <- seq(0.1, 0.9, by = 0.1)
Q <- qmaxwell(probs, a = a)
lines(Q, dmaxwell(Q, a), col = "purple", lty = 3, type = "h")
lines(Q, pmaxwell(Q, a), col = "purple", lty = 3, type = "h")
abline(h = probs, col = "purple", lty = 3)
max(abs(pmaxwell(Q, a) - probs)) # Should be zero
Run the code above in your browser using DataLab