Skip to contents

Computes the quantile function (inverse CDF) for the two-parameter Kumaraswamy (Kw) distribution with shape parameters alpha (\(\alpha\)) and beta (\(\beta\)). It finds the value q such that \(P(X \le q) = p\).

Usage

qkw(p, alpha = 1, beta = 1, lower.tail = TRUE, log.p = FALSE)

Arguments

p

Vector of probabilities (values between 0 and 1).

alpha

Shape parameter alpha > 0. Can be a scalar or a vector. Default: 1.0.

beta

Shape parameter beta > 0. Can be a scalar or a vector. Default: 1.0.

lower.tail

Logical; if TRUE (default), probabilities are \(p = P(X \le q)\), otherwise, probabilities are \(p = P(X > q)\).

log.p

Logical; if TRUE, probabilities p are given as \(\log(p)\). Default: FALSE.

Value

A vector of quantiles corresponding to the given probabilities p. The length of the result is determined by the recycling rule applied to the arguments (p, alpha, beta). Returns:

  • 0 for p = 0 (or p = -Inf if log.p = TRUE, when lower.tail = TRUE).

  • 1 for p = 1 (or p = 0 if log.p = TRUE, when lower.tail = TRUE).

  • NaN for p < 0 or p > 1 (or corresponding log scale).

  • An out-of-bound or missing parameter is an error, not a return value: the wrapper stops with a message naming the parameter. An infinite parameter is not currently intercepted there and reaches the C++ layer, which treats it as invalid.

Boundary return values are adjusted accordingly for lower.tail = FALSE.

Details

The quantile function \(Q(p)\) is the inverse of the CDF \(F(q)\). The CDF for the Kumaraswamy distribution is \(F(q) = 1 - (1 - q^\alpha)^\beta\) (see pkw). Inverting this equation for \(q\) yields the quantile function: $$ Q(p) = \left\{ 1 - (1 - p)^{1/\beta} \right\}^{1/\alpha} $$ The function uses this closed-form expression and correctly handles the lower.tail and log.p arguments by transforming p appropriately before applying the formula. This is equivalent to the general GKw quantile function (qgkw) evaluated with \(\gamma=1, \delta=0, \lambda=1\).

References

Kumaraswamy, P. (1980). A generalized probability density function for double-bounded random processes. Journal of Hydrology, 46(1-2), 79-88. doi:10.1016/0022-1694(80)90036-0

Jones, M. C. (2009). Kumaraswamy's distribution: A beta-type distribution with some tractability advantages. Statistical Methodology, 6(1), 70-81. doi:10.1016/j.stamet.2008.04.001

See also

qgkw (parent distribution quantile function), dkw, pkw, rkw (other Kw functions), qbeta, qunif

Other quantile functions: qbeta_(), qbkw(), qekw(), qgkw(), qkkw(), qmc()

Author

Lopes, J. E.

Examples

p <- c(0.1, 0.5, 0.9)
qkw(p, alpha = 2, beta = 3)
#> [1] 0.1857703 0.4542020 0.7320117
qkw(p, alpha = 2, beta = 3, lower.tail = FALSE)  # upper-tail quantiles
#> [1] 0.7320117 0.4542020 0.1857703

## qkw() inverts pkw()
all.equal(pkw(qkw(p, alpha = 2, beta = 3), alpha = 2, beta = 3), p)
#> [1] TRUE