Beta Distribution in R Language is defined as property which represents the possible values of probability. This article is an illustration of dbeta, pbeta, qbeta, and rbeta functions of Beta Distribution.
dbeta() Function
It is defined as Beta Density function and is used to create beta density value corresponding to the vector of quantiles.
Syntax: dbeta(vec, shape1, shape2) Parameter: vec: Vector to be used shape1, shape2: beta density of input values Returns: beta density values for a vector of quantiles
Example :
r
x_beta <- seq (0, 1.5, by = 0.025 )
y_beta <- dbeta (x_beta, shape1 = 2, shape2 = 4.5)
plot (y_beta)
|
Output: 
pbeta() Function
It is used to create cumulative distribution function of the beta distribution.
Syntax: pbeta(vec, shape1, shape2) Parameter: vec: Vector to be used shape1, shape2: beta density of input values
Example:
r
x_pbeta <- seq (0, 1, by = 0.025)
y_pbeta <- pbeta (x_pbeta, shape1 = 1, shape2 = 4)
plot (y_pbeta)
|
Output: 
qbeta() Function
It is known as beta quantile function and used to return quantile values of the function.
Syntax: qbeta(vec, shape1, shape2) Parameters: vec: Vector to be used shape1, shape2: beta density of input values
Example:
r
x_qbeta <- seq (0, 1, by = 0.025)
y_qbeta <- qbeta (x_qbeta, shape1 = 1, shape2 = 4)
plot (y_qbeta)
|
Output: 
rbeta() Function
It is defined as a random number generator that is used to set seed and specify sample size.
Syntax: rbeta(N, shape1, shape2 ) Parameters: vec: Vector to be used shape1, shape2: beta density of input values
Example:
r
set.seed (13579)
N <- 10000
y_rbeta <- rbeta (N, shape1 = 1, shape2 = 5)
y_rbeta
plot ( density (y_rbeta),
main = "beta Distribution in R")
|
Output: 
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Last Updated :
19 Dec, 2022
Like Article
Save Article