template<typename T = double>
BetaPrior class
Beta distribution prior - conjugate for Bernoulli/Binomial likelihoods.
Particularly useful for modeling probabilities and proportions in [0,1]
Base classes
-
template<typename T = double>class PriorDistribution<double>
- Abstract base class for prior distributions in Bayesian analysis.
Public types
- using distribution_type = boost::math::beta_distribution<T>
Constructors, destructors, conversion operators
- BetaPrior(T alpha, T beta)
- Construct a Beta prior.
Public functions
- auto pdf(T x) const -> T override
- Evaluate the probability density at a given point.
- auto log_pdf(T x) const -> T override
- Evaluate the log probability density.
- auto cdf(T x) const -> T override
- Evaluate the cumulative distribution function.
- auto sample(boost::random::mt19937& gen) const -> T override
- Generate a random sample from the distribution.
- auto mean() const -> T override
- Get the mean of the distribution.
- auto variance() const -> T override
- Get the variance of the distribution.
- auto mode() const -> std::optional<T> override
- Get the mode of the distribution (if exists)
- auto support() const -> std::pair<T, T> override
- Get the support of the distribution.
- auto name() const -> std::string override
- Get the name of the distribution.
- auto clone() const -> std::unique_ptr<PriorDistribution<T>> override
- Clone the distribution.
- auto is_conjugate_to(const std::string& likelihood_family) const -> bool override
- Check if this is a conjugate prior for a given likelihood.
- auto alpha() const -> T
- Get the alpha parameter.
- auto beta() const -> T
- Get the beta parameter.
Function documentation
template<typename T>
liarsdice:: bayesian:: BetaPrior<T>:: BetaPrior(T alpha,
T beta)
Construct a Beta prior.
| Parameters | |
|---|---|
| alpha | Shape parameter α > 0 |
| beta | Shape parameter β > 0 |
template<typename T>
T liarsdice:: bayesian:: BetaPrior<T>:: pdf(T x) const override
Evaluate the probability density at a given point.
| Parameters | |
|---|---|
| x | Point at which to evaluate the PDF |
| Returns | Probability density value |
template<typename T>
T liarsdice:: bayesian:: BetaPrior<T>:: log_pdf(T x) const override
Evaluate the log probability density.
| Parameters | |
|---|---|
| x | Point at which to evaluate the log PDF |
| Returns | Log probability density value |
template<typename T>
T liarsdice:: bayesian:: BetaPrior<T>:: cdf(T x) const override
Evaluate the cumulative distribution function.
| Parameters | |
|---|---|
| x | Point at which to evaluate the CDF |
| Returns | Cumulative probability |
template<typename T>
T liarsdice:: bayesian:: BetaPrior<T>:: sample(boost::random::mt19937& gen) const override
Generate a random sample from the distribution.
| Parameters | |
|---|---|
| gen | Random number generator |
| Returns | Random sample |
template<typename T>
std::pair<T, T> liarsdice:: bayesian:: BetaPrior<T>:: support() const override
Get the support of the distribution.
| Returns | Pair of (lower_bound, upper_bound) |
|---|