| rbeta_ | R Documentation |
Generates random deviates from the standard Beta distribution, using a
parameterization common in generalized distribution families. The distribution
is parameterized by gamma (\gamma) and delta (\delta),
corresponding to the standard Beta distribution with shape parameters
shape1 = gamma and shape2 = delta + 1. This is a special case
of the Generalized Kumaraswamy (GKw) distribution where \alpha = 1,
\beta = 1, and \lambda = 1.
rbeta_(n, gamma, delta)
n |
Number of observations. If |
gamma |
First shape parameter ( |
delta |
Second shape parameter is |
This function generates samples from a Beta distribution with parameters
shape1 = gamma and shape2 = delta + 1. It is equivalent to
calling stats::rbeta(n, shape1 = gamma, shape2 = delta + 1).
This distribution arises as a special case of the five-parameter
Generalized Kumaraswamy (GKw) distribution (rgkw) obtained
by setting \alpha = 1, \beta = 1, and \lambda = 1.
It is therefore also equivalent to the McDonald (Mc)/Beta Power distribution
(rmc) with \lambda = 1.
The function likely calls R's underlying rbeta function but ensures
consistent parameter recycling and handling within the C++ environment,
matching the style of other functions in the related families.
A numeric vector of length n containing random deviates from the
Beta(\gamma, \delta+1) distribution, with values in (0, 1). The length
of the result is determined by n and the recycling rule applied to
the parameters (gamma, delta). Returns NaN if parameters
are invalid (e.g., gamma <= 0, delta < 0).
Lopes, J. E.
Johnson, N. L., Kotz, S., & Balakrishnan, N. (1995). Continuous Univariate Distributions, Volume 2 (2nd ed.). Wiley.
Cordeiro, G. M., & de Castro, M. (2011). A new family of generalized distributions. Journal of Statistical Computation and Simulation,
Devroye, L. (1986). Non-Uniform Random Variate Generation. Springer-Verlag.
rbeta (standard R implementation),
rgkw (parent distribution random generation),
rmc (McDonald/Beta Power random generation),
dbeta_, pbeta_, qbeta_ (other functions for this parameterization, if they exist).
set.seed(2030) # for reproducibility
# Generate 1000 samples using rbeta_
gamma_par <- 2.0 # Corresponds to shape1
delta_par <- 3.0 # Corresponds to shape2 - 1
shape1 <- gamma_par
shape2 <- delta_par + 1
x_sample <- rbeta_(1000, gamma = gamma_par, delta = delta_par)
summary(x_sample)
# Compare with stats::rbeta
x_sample_stats <- stats::rbeta(1000, shape1 = shape1, shape2 = shape2)
# Visually compare histograms or QQ-plots
hist(x_sample, main="rbeta_ Sample", freq=FALSE, breaks=30)
curve(dbeta_(x, gamma_par, delta_par), add=TRUE, col="red", lwd=2)
hist(x_sample_stats, main="stats::rbeta Sample", freq=FALSE, breaks=30)
curve(stats::dbeta(x, shape1, shape2), add=TRUE, col="blue", lwd=2)
# Compare summary stats (should be similar due to randomness)
print(summary(x_sample))
print(summary(x_sample_stats))
# Compare summary stats with rgkw(alpha=1, beta=1, lambda=1)
x_sample_gkw <- rgkw(1000, alpha = 1.0, beta = 1.0, gamma = gamma_par,
delta = delta_par, lambda = 1.0)
print("Summary stats for rgkw(a=1,b=1,l=1) sample:")
print(summary(x_sample_gkw))
# Compare summary stats with rmc(lambda=1)
x_sample_mc <- rmc(1000, gamma = gamma_par, delta = delta_par, lambda = 1.0)
print("Summary stats for rmc(l=1) sample:")
print(summary(x_sample_mc))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.