DPQ (version 0.3-3)

qbetaAppr: Compute (Approximate) Quantiles of the Beta Distribution

Description

Compute quantiles (inverse distribution values) for the beta distribution, using diverse approximations.

Usage


qbetaAppr.1(a, p, q, y = qnormUappr(a))
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, y = qnormUappr(a),
            verbose = getOption("verbose"))

qbetaAppr (a, p, q, y = qnormUappr(a), 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 qbeta(), called p).

p, q

the two shape parameters of the beta distribution; otherwise, e.g., in qbeta(), called shape1 and shape2.

y

an approximation to \(\Phi^{-1}(1-\alpha)\) (aka \(z_{1-\alpha}\)) where \(\Phi(x)\) is the standard normal cumulative probability function and \(\Phi{-1}(x)\) its inverse, i.e., R's qnorm(x).

lower.tail, log.p

logical, see, e.g., qchisq(); must have length 1.

logbeta

must be lbeta(p,q); mainly an option to pass a value already computed.

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 1e-15 has been hardwired in R's qbeta().

f.acu

a function with arguments (a,p,q) ...TODO...

fpu

a very small positive number.

qnormU.fun

a function with arguments (u,lu) to compute “the same” as qnormUappr(), the upper standard normal quantile.

R.pre.2014

a logical ... TODO ...

non.finite.report

logical indicating if during the “outer loop” refining iterations, if y becomes non finite and the iterations have to stop, it should be reported (before the current best value is returned).

Value

...

See Also

qbeta.

Examples

Run this code
# NOT RUN {
 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) # -> 1.776357e-15  now gives 4.651188e-31 !!!
 qbeta  (0.5078, .01, 5, ncp=0) #      also     gives 4.651188e-31
# }

Run the code above in your browser using DataCamp Workspace