| pkw | R Documentation |
Computes the cumulative distribution function (CDF), P(X \le q), for the
two-parameter Kumaraswamy (Kw) distribution with shape parameters alpha
(\alpha) and beta (\beta). This distribution is defined
on the interval (0, 1).
pkw(q, alpha, beta, lower_tail = TRUE, log_p = FALSE)
q |
Vector of quantiles (values generally between 0 and 1). |
alpha |
Shape parameter |
beta |
Shape parameter |
lower_tail |
Logical; if |
log_p |
Logical; if |
The cumulative distribution function (CDF) of the Kumaraswamy (Kw) distribution is given by:
F(x; \alpha, \beta) = 1 - (1 - x^\alpha)^\beta
for 0 < x < 1, \alpha > 0, and \beta > 0.
The Kw distribution is a special case of several generalized distributions:
Generalized Kumaraswamy (pgkw) with \gamma=1, \delta=0, \lambda=1.
Exponentiated Kumaraswamy (pekw) with \lambda=1.
Kumaraswamy-Kumaraswamy (pkkw) with \delta=0, \lambda=1.
The implementation uses the closed-form expression for efficiency.
A vector of probabilities, F(q), or their logarithms/complements
depending on lower_tail and log_p. The length of the result
is determined by the recycling rule applied to the arguments (q,
alpha, beta). Returns 0 (or -Inf if
log_p = TRUE) for q <= 0 and 1 (or 0 if
log_p = TRUE) for q >= 1. Returns NaN for invalid
parameters.
Lopes, J. E.
Kumaraswamy, P. (1980). A generalized probability density function for double-bounded random processes. Journal of Hydrology, 46(1-2), 79-88.
Jones, M. C. (2009). Kumaraswamy's distribution: A beta-type distribution with some tractability advantages. Statistical Methodology, 6(1), 70-81.
pgkw, pekw, pkkw (related generalized CDFs),
dkw, qkw, rkw (other Kw functions),
pbeta
# Example values
q_vals <- c(0.2, 0.5, 0.8)
alpha_par <- 2.0
beta_par <- 3.0
# Calculate CDF P(X <= q) using pkw
probs <- pkw(q_vals, alpha_par, beta_par)
print(probs)
# Calculate upper tail P(X > q)
probs_upper <- pkw(q_vals, alpha_par, beta_par, lower_tail = FALSE)
print(probs_upper)
# Check: probs + probs_upper should be 1
print(probs + probs_upper)
# Calculate log CDF
log_probs <- pkw(q_vals, alpha_par, beta_par, log_p = TRUE)
print(log_probs)
# Check: should match log(probs)
print(log(probs))
# Compare with pgkw setting gamma = 1, delta = 0, lambda = 1
probs_gkw <- pgkw(q_vals, alpha_par, beta_par, gamma = 1.0, delta = 0.0,
lambda = 1.0)
print(paste("Max difference:", max(abs(probs - probs_gkw)))) # Should be near zero
# Plot the CDF for different shape parameter combinations
curve_q <- seq(0.001, 0.999, length.out = 200)
plot(curve_q, pkw(curve_q, alpha = 2, beta = 3), type = "l",
main = "Kumaraswamy CDF Examples", xlab = "q", ylab = "F(q)",
col = "blue", ylim = c(0, 1))
lines(curve_q, pkw(curve_q, alpha = 3, beta = 2), col = "red")
lines(curve_q, pkw(curve_q, alpha = 0.5, beta = 0.5), col = "green")
lines(curve_q, pkw(curve_q, alpha = 5, beta = 1), col = "purple")
lines(curve_q, pkw(curve_q, alpha = 1, beta = 3), col = "orange")
legend("bottomright", legend = c("a=2, b=3", "a=3, b=2", "a=0.5, b=0.5", "a=5, b=1", "a=1, b=3"),
col = c("blue", "red", "green", "purple", "orange"), lty = 1, bty = "n", ncol = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.