Learn R Programming

distributional (version 0.6.0)

dist_beta: The Beta distribution

Description

[Stable]

The Beta distribution is a continuous probability distribution defined on the interval [0, 1], commonly used to model probabilities and proportions.

Usage

dist_beta(shape1, shape2)

Arguments

shape1, shape2

The non-negative shape parameters of the Beta distribution.

Details

We recommend reading this documentation on pkgdown which renders math nicely. https://pkg.mitchelloharawild.com/distributional/reference/dist_beta.html

In the following, let \(X\) be a Beta random variable with parameters shape1 = \(\alpha\) and shape2 = \(\beta\).

Support: \(x \in [0, 1]\)

Mean: \(\frac{\alpha}{\alpha + \beta}\)

Variance: \(\frac{\alpha\beta}{(\alpha + \beta)^2(\alpha + \beta + 1)}\)

Probability density function (p.d.f):

$$ f(x) = \frac{x^{\alpha - 1}(1-x)^{\beta - 1}}{B(\alpha, \beta)} = \frac{\Gamma(\alpha + \beta)}{\Gamma(\alpha)\Gamma(\beta)} x^{\alpha - 1}(1-x)^{\beta - 1} $$

where \(B(\alpha, \beta) = \frac{\Gamma(\alpha)\Gamma(\beta)}{\Gamma(\alpha + \beta)}\) is the Beta function.

Cumulative distribution function (c.d.f):

$$ F(x) = I_x(alpha, beta) = \frac{B(x; \alpha, \beta)}{B(\alpha, \beta)} $$

where \(I_x(\alpha, \beta)\) is the regularized incomplete beta function and \(B(x; \alpha, \beta) = \int_0^x t^{\alpha-1}(1-t)^{\beta-1} dt\).

Moment generating function (m.g.f):

The moment generating function does not have a simple closed form, but the moments can be calculated as:

$$ E(X^k) = \prod_{r=0}^{k-1} \frac{\alpha + r}{\alpha + \beta + r} $$

See Also

Examples

Run this code
dist <- dist_beta(shape1 = c(0.5, 5, 1, 2, 2), shape2 = c(0.5, 1, 3, 2, 5))

dist
mean(dist)
variance(dist)
skewness(dist)
kurtosis(dist)

generate(dist, 10)

density(dist, 2)
density(dist, 2, log = TRUE)

cdf(dist, 4)

quantile(dist, 0.7)

Run the code above in your browser using DataLab