data(qbBaha2017)
str(qbBaha2017)
str(ab <- lapply(dimnames(qbBaha2017), as.numeric))
stopifnot(ab$a == c((1:6)/2, 5, 10, 25),
ab$b == c(1:15, 10*c(2:5, 10, 25, 50)))
matplot(ab$b, t(qbBaha2017)[,9:1], type="l", log = "x", xlab = "b",
ylab = "qbeta(.95, a,b)",
main = "Guaranteed accuracy 95% percentiles of Beta distribution")
legend("right", paste("a = ", format(ab$a)),
lty=1:5, col=1:6, bty="n")
## Relative error of R's qbeta() -- given that the table only shows 6
## digits, there is *no* relevant error: R's qbeta() is accurate enough:
x.ab <- do.call(expand.grid, ab)
matplot(ab$b, 1 - t(qbeta(0.95, x.ab$a, x.ab$b) / qbBaha2017),
main = "rel.error of R's qbeta() -- w/ 6 digits, it is negligible",
ylab = "1 - qbeta()/'true'",
type = "l", log="x", xlab="b")
abline(h=0, col=adjustcolor("gray", 1/2))
Run the code above in your browser using DataLab