CMP++: Uncertainty Quantification & Bayesian Calibration
Loading...
Searching...
No Matches
cmp::distribution::UnivariateDistribution< Derived > Class Template Reference

CRTP base class for all univariate probability distributions. More...

#include <distribution.h>

Public Member Functions

double logPDF (const double &x) const
 Computes the log probability density function (log-PDF) of the distribution.
 
double dLogPDF (const double &x) const
 Computes the first derivative of the log-PDF.
 
double ddLogPDF (const double &x) const
 Computes the second derivative of the log-PDF.
 
double CDF (const double &x) const
 Computes the cumulative distribution function (CDF).
 
double quantile (const double &p) const
 Computes the quantile function (inverse CDF).
 
double sample (std::default_random_engine &rng)
 Draws a single pseudo-random sample from the distribution.
 

Detailed Description

template<typename Derived>
class cmp::distribution::UnivariateDistribution< Derived >

CRTP base class for all univariate probability distributions.

Mathematical Formulation Defines a probability distribution over a scalar random variable \(X \in \mathbb{R}\) with probability density function \(p(x)\). Provides static polymorphic interfaces for:

  • Log-likelihood: \(\log p(x)\)
  • First-order score: \(\frac{d}{dx} \log p(x)\)
  • Second-order Hessian: \(\frac{d^2}{dx^2} \log p(x)\)
  • Cumulative distribution function (CDF): \(F(x) = \int_{-\infty}^x p(t) dt\)
  • Quantile function: \(F^{-1}(p)\) for \(p \in [0, 1]\)

    Implementation Algorithm Uses the Curiously Recurring Template Pattern (CRTP) for compile-time devirtualization of statistical calls.

Member Function Documentation

◆ CDF()

template<typename Derived >
double cmp::distribution::UnivariateDistribution< Derived >::CDF ( const double &  x) const
inline

Computes the cumulative distribution function (CDF).

Parameters
xPoint at which to evaluate the CDF.
Returns
Evaluated CDF value in [0, 1].

◆ ddLogPDF()

template<typename Derived >
double cmp::distribution::UnivariateDistribution< Derived >::ddLogPDF ( const double &  x) const
inline

Computes the second derivative of the log-PDF.

Parameters
xPoint at which to evaluate the second derivative.
Returns
Evaluated second derivative.

◆ dLogPDF()

template<typename Derived >
double cmp::distribution::UnivariateDistribution< Derived >::dLogPDF ( const double &  x) const
inline

Computes the first derivative of the log-PDF.

Parameters
xPoint at which to evaluate the derivative.
Returns
Evaluated first derivative.

◆ logPDF()

template<typename Derived >
double cmp::distribution::UnivariateDistribution< Derived >::logPDF ( const double &  x) const
inline

Computes the log probability density function (log-PDF) of the distribution.

Parameters
xPoint at which to evaluate the log-PDF.
Returns
Evaluated log-PDF.

◆ quantile()

template<typename Derived >
double cmp::distribution::UnivariateDistribution< Derived >::quantile ( const double &  p) const
inline

Computes the quantile function (inverse CDF).

Parameters
pProbability value in [0, 1].
Returns
The quantile value x such that CDF(x) = p.

◆ sample()

template<typename Derived >
double cmp::distribution::UnivariateDistribution< Derived >::sample ( std::default_random_engine &  rng)
inline

Draws a single pseudo-random sample from the distribution.

Parameters
rngRandom number engine.
Returns
A random sample.

The documentation for this class was generated from the following file: