1 #ifndef _utl_NormalDistribution_h_
2 #define _utl_NormalDistribution_h_
7 #include <utl/MathConstants.h>
16 inline double NormalPDF(
const double x,
const double sigma)
20 inline double NormalPDF(
const double x,
const double mean,
const double sigma)
44 return std::log(std::erfc(x));
46 const double x2 =
Sqr(x);
47 return -(x2 + std::log(x) + 0.5/x2 + 0.5*std::log(M_PI));
52 {
return 0.5 * std::erfc(-x / M_SQRT2); }
55 inline double NormalCDF(
const double x,
const double sigma)
59 inline double NormalCDF(
const double x,
const double mean,
const double sigma)
103 const double xmin,
const double xmax);
double LogarithmOfNormalComplementCDF(const double x)
constexpr double kSqrt2Pi
constexpr T Sqr(const T &x)
double TruncatedNormalPDF(const double x, const double mu, const double sigma, const double xmin, const double xmax)
double PositiveNormalPDF(double x, double mu, double sigma)
Truncated normal distribution with xmin = 0 and xmax = infinity.
double LogarithmOfErfc(const double x)
double InverseNormalCDF(const double p)
Inverse of the comulative normal distribution. Taken from http://home.online.no/~pjacklam/notes/invno...
double NormalPDF(const double x)
double NormalCDF(const double x)
double LogarithmOfNormalCDF(const double x)
double LogarithmOfNormalPDF(const double x)