# qnormAppr

From DPQ v0.3-3
0th

Percentile

##### Approximations to 'qnorm()', i.e., $z_\alpha$

Relatively simple approximations to the standard normal (aka “Gaussian”) quantiles, i.e., the inverse of the normal cumulative probability function.

qnormUappr() is a simple approximation to (the upper tail) standard normal quantiles, qnorm().

Keywords
distribution
##### Usage
qnormAppr(p)
qnormUappr(p, lp = .DT_Clog(p, lower.tail=lower.tail, log.p=log.p),
lower.tail = FALSE, log.p = FALSE)
##### Arguments
p

numeric vector of probabilities, possibly transformed, depending on log.p. Does not need to be specified, if lp is instead.

lp

log(1 - p*), assuming $p*$ is the lower.tail=TRUE, log.p=FALSE version of p. If passed as argument, it can be much more accurate than when computed from p by default.

lower.tail

logical; if TRUE (not the default here!), probabilities are $P[X \le x]$, otherwise (by default) upper tail probabilities, $P[X > x]$.

log.p

logical; if TRUE, probabilities $p$ are given as $\log(p)$ in argument p.

##### Details

qnormAppr(p) uses the simple 4 coefficient rational approximation to qnorm(p), to be used only for $p > 1/2$ in qbeta() computations, e.g., qbeta.R.

The relative error of this approximation is quite asymmetric: It is mainly < 0.

qnormUappr(p) uses the same rational approximation directly for the Upper tail where it is relatively good, and for the lower tail via “swapping the tails”, so it is good there as well.

##### Value

numeric vector of (approximate) normal quantiles corresponding to probabilities p

qnorm.

• qnormAppr
• qnormUappr
##### Examples
# 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)