Loading...
Searching...
No Matches
DistributionFunctions.h
Go to the documentation of this file.
1//
2// DistributionFunctions.h
3// gpr_dimer
4//
5// Created by Maxim Masterov on 03/12/2020.
6//
7
8#ifndef DistributionFunctions_h
9#define DistributionFunctions_h
10
11#include <cmath>
12
13namespace math {
18public:
21
30 inline double normalCDF(const double x, double const mu, const double sigma)
31 {
32 double x_loc = (x - mu) / sigma;
33 return 0.5 * erfc(-x_loc * M_SQRT1_2);
34 }
35
44 inline double normalCDFInverse(const double p, double const mu,
45 const double sigma)
46 {
47 return mu + sigma * M_SQRT2 * erfinv(2. * p - 1.);
48 }
49
57 double erfinv(double x);
58};
59} // namespace math
60#endif /* DistributionFunctions_h */
@ x
Definition Enums.h:28
double normalCDF(const double x, double const mu, const double sigma)
Normal cumulative distribution function.
double erfinv(double x)
Inverse error function NOTE: Abramowitz & Stegun rational approximation, taken from http://libit....
double normalCDFInverse(const double p, double const mu, const double sigma)
Inverse complementary error function.