Creates an S3 object representing a beta distribution with shape parameters shape1 and shape2. The PDF on \((0, 1)\) is $$f(x) = \frac{x^{a-1}(1-x)^{b-1}}{B(a,b)}$$ where \(a\) = shape1, \(b\) = shape2, and \(B(a,b)\) is the beta function.

beta_dist(shape1, shape2)

Arguments

shape1

First shape parameter, must be a positive scalar.

shape2

Second shape parameter, must be a positive scalar.

Value

A beta_dist object with classes c("beta_dist", "univariate_dist", "continuous_dist", "dist").

Examples

x <- beta_dist(shape1 = 2, shape2 = 5)
mean(x)
#> [1] 0.2857143
vcov(x)
#> [1] 0.0255102
format(x)
#> [1] "Beta distribution (shape1 = 2, shape2 = 5)"