template<typename T = double>
liarsdice::bayesian::GammaPrior class

Gamma distribution prior - conjugate for Poisson and Exponential likelihoods.

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::gamma_distribution<T>

Constructors, destructors, conversion operators

GammaPrior(T shape, T rate)

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 shape parameter (alpha)
auto beta() const -> T
Get the rate parameter (beta)

Function documentation

template<typename T>
T liarsdice::bayesian::GammaPrior<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::GammaPrior<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::GammaPrior<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::GammaPrior<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::GammaPrior<T>::support() const override

Get the support of the distribution.

Returns Pair of (lower_bound, upper_bound)