# NOT RUN {
pp <- c(.001, .005, .01, .05, (1:9)/10, .95, .99, .995, .999)
z_p <- qnorm(pp)
(R <- cbind(pp, z_p, qA = qnormAppr(pp), qUA = qnormUappr(pp, lower.tail=TRUE)))
## Errors, absolute and relative:
cbind(pp, (relE <- cbind(
errA = z_p - R[,"qA" ],
errUA = z_p - R[,"qUA"],
rE.A = 1 - R[,"qA" ]/z_p,
rE.UA = 1 - R[,"qUA"]/z_p)))
lp <- -c(1000, 500, 200, 100, 50, 20:10, seq(9.75, 0, by = -1/8))
qnormUappr(lp=lp) # 'p' need not be specified if 'lp' is
curve(qnorm(x, lower.tail=FALSE), n=1001)
curve(qnormUappr(x), add=TRUE, n=1001, col = adjustcolor("red", 1/2))
curve(qnorm(x, lower.tail=FALSE) - qnormUappr(x), n=1001)
# }
Run the code above in your browser using DataCamp Workspace