qbetaAppr {DPQ} | R Documentation |
Compute (Approximate) Quantiles of the Beta Distribution
Description
Compute quantiles (inverse distribution values) of the beta distribution, using diverse approximations.
Usage
qbetaAppr.1(a, p, q, lower.tail=TRUE, log.p=FALSE,
y = qnormUappr(a, lower.tail=lower.tail, log.p=log.p))
qbetaAppr.2(a, p, q, lower.tail=TRUE, log.p=FALSE, logbeta = lbeta(p,q))
qbetaAppr.3(a, p, q, lower.tail=TRUE, log.p=FALSE, logbeta = lbeta(p,q))
qbetaAppr.4(a, p, q, lower.tail=TRUE, log.p=FALSE,
y = qnormUappr(a, lower.tail=lower.tail, log.p=log.p),
verbose = getOption("verbose"))
qbetaAppr (a, p, q, lower.tail=TRUE, log.p=FALSE,
y = qnormUappr(a, lower.tail=lower.tail, log.p=log.p),
logbeta = lbeta(p,q),
verbose = getOption("verbose") && length(a) == 1)
qbeta.R (alpha, p, q,
lower.tail = TRUE, log.p = FALSE,
logbeta = lbeta(p,q),
low.bnd = 3e-308, up.bnd = 1-2.22e-16,
method = c("AS109", "Newton-log"),
tol.outer = 1e-15,
f.acu = function(a,p,q) max(1e-300, 10^(-13- 2.5/pp^2 - .5/a^2)),
fpu = .Machine$ double.xmin,
qnormU.fun = function(u, lu) qnormUappr(p=u, lp=lu)
, R.pre.2014 = FALSE
, verbose = getOption("verbose")
, non.finite.report = verbose
)
Arguments
a , alpha |
vector of probabilities (otherwise, e.g., in
|
p , q |
the two shape parameters of the beta distribution; otherwise, e.g., in
|
y |
an approximation to |
lower.tail , log.p |
logical, see, e.g., |
logbeta |
must be |
verbose |
logical or integer indicating if and how much “monitoring” information should be produced by the algorithm. |
low.bnd , up.bnd |
lower and upper bounds for ...TODO... |
method |
a string specifying the approximation method to be used. |
tol.outer |
the “outer loop” convergence tolerance; the
default |
f.acu |
a |
fpu |
a very small positive number. |
qnormU.fun |
a |
R.pre.2014 |
a |
non.finite.report |
|
Value
...
Author(s)
The R Core Team for the C version of qbeta
in R's sources;
Martin Maechler for the R port, and the approximations.
See Also
Examples
qbeta.R(0.6, 2, 3) # 0.4445
qbeta.R(0.6, 2, 3) - qbeta(0.6, 2,3) # almost 0
qbetaRV <- Vectorize(qbeta.R, "alpha") # now can use
curve(qbetaRV(x, 1.5, 2.5))
curve(qbeta (x, 1.5, 2.5), add=TRUE, lwd = 3, col = adjustcolor("red", 1/2))
## an example of disagreement (and doubt, as borderline, close to underflow):
qbeta.R(0.5078, .01, 5) # -> 2.77558e-15 # but
qbeta (0.5078, .01, 5) # now gives 4.651188e-31 -- correctly!
qbeta (0.5078, .01, 5, ncp=0)# ditto
## which is because qbeta() now works in log-x scale here:
curve(pbeta(x, .01, 5), 1e-40, 1, n=10001, log="x", xaxt="n")
sfsmisc::eaxis(1); abline(h=.5078, lty=3); abline(v=4.651188e-31,col=2)