openGPMP
Open Source Mathematics Package
pdfs.hpp
Go to the documentation of this file.
1 /*************************************************************************
2  *
3  * Project
4  * _____ _____ __ __ _____
5  * / ____| __ \| \/ | __ \
6  * ___ _ __ ___ _ __ | | __| |__) | \ / | |__) |
7  * / _ \| '_ \ / _ \ '_ \| | |_ | ___/| |\/| | ___/
8  *| (_) | |_) | __/ | | | |__| | | | | | | |
9  * \___/| .__/ \___|_| |_|\_____|_| |_| |_|_|
10  * | |
11  * |_|
12  *
13  * Copyright (C) Akiel Aries, <akiel@akiel.org>, et al.
14  *
15  * This software is licensed as described in the file LICENSE, which
16  * you should have received as part of this distribution. The terms
17  * among other details are referenced in the official documentation
18  * seen here : https://akielaries.github.io/openGPMP/ along with
19  * important files seen in this project.
20  *
21  * You may opt to use, copy, modify, merge, publish, distribute
22  * and/or sell copies of the Software, and permit persons to whom
23  * the Software is furnished to do so, under the terms of the
24  * LICENSE file.
25  *
26  *
27  *
28  * This software is distributed on an AS IS basis, WITHOUT
29  * WARRANTY OF ANY KIND, either express or implied.
30  *
31  ************************************************************************/
32 #ifndef PDFS_HPP
33 #define PDFS_HPP
34 
35 namespace gpmp {
36 namespace stats {
37 
41 class PDF {
42  public:
50  static double bernoulli(double x, double p);
51 
61  static double beta(double x, double alpha, double beta);
62 
72  static double binomial(int k, int n, double p);
73 
83  static double cauchy(double x, double x0, double gamma);
84 
93  static double chi_squared(double x, int k);
94 
103  static double exponential(double x, double lambda);
104 
114  static double f_dist(double x, int df1, int df2);
115 
125  static double gamma(double x, double alpha, double beta);
126 
136  static double inverse_gamma(double x, double alpha, double beta);
137 
147  static double inverse_gaussian(double x, double mu, double lambda);
148 
158  static double laplace(double x, double mu, double b);
159 
169  static double logistic(double x, double mu, double s);
170 
181  static double log_normal(double x, double mu, double sigma);
182 
192  static double gaussian(double x, double mu, double sigma);
193 
202  static double poisson(int k, double lambda);
203 
211  static double rademacher(int k);
212 
221  static double student_t(double x, int df);
222 
232  static double uniform(double x, double a, double b);
233 
243  static double weibull(double x, double k, double lambda);
244 
252  static double binomial_coefficient(int n, int k);
253 
261  static double beta_function(double alpha, double beta);
262 
269  static double factorial(int n);
270 };
271 } // namespace stats
272 } // namespace gpmp
273 
274 #endif
Class representing Probability Distribution Functions (PDFs)
Definition: pdfs.hpp:41
static double bernoulli(double x, double p)
Calculates the probability of success in a Bernoulli trial.
Definition: pdfs.cpp:44
static double gamma(double x, double alpha, double beta)
Calculates the probability density function (PDF) of the gamma distribution.
Definition: pdfs.cpp:106
static double beta(double x, double alpha, double beta)
Calculates the probability density function (PDF) of the Beta distribution.
Definition: pdfs.cpp:54
static double poisson(int k, double lambda)
Calculates the probability density function (PDF) of the Poisson distribution.
Definition: pdfs.cpp:160
static double gaussian(double x, double mu, double sigma)
Calculates the probability density function (PDF) of the Gaussian (normal) distribution.
Definition: pdfs.cpp:154
static double log_normal(double x, double mu, double sigma)
Calculates the probability density function (PDF) of the log-normal distribution.
Definition: pdfs.cpp:145
static double binomial(int k, int n, double p)
Calculates the probability of observing k successes in n independent Bernoulli trials.
Definition: pdfs.cpp:63
static double uniform(double x, double a, double b)
Calculates the probability density function (PDF) of the uniform distribution.
Definition: pdfs.cpp:186
static double f_dist(double x, int df1, int df2)
Calculates the probability density function (PDF) of the F distribution.
Definition: pdfs.cpp:95
static double exponential(double x, double lambda)
Calculates the probability density function (PDF) of the exponential distribution.
Definition: pdfs.cpp:87
static double inverse_gaussian(double x, double mu, double lambda)
Calculates the probability density function (PDF) of the inverse Gaussian distribution.
Definition: pdfs.cpp:125
static double inverse_gamma(double x, double alpha, double beta)
Calculates the probability density function (PDF) of the inverse gamma distribution.
Definition: pdfs.cpp:115
static double weibull(double x, double k, double lambda)
Calculates the probability density function (PDF) of the Weibull distribution.
Definition: pdfs.cpp:194
static double chi_squared(double x, int k)
Calculates the probability density function (PDF) of the chi-squared distribution.
Definition: pdfs.cpp:78
static double laplace(double x, double mu, double b)
Calculates the probability density function (PDF) of the Laplace distribution.
Definition: pdfs.cpp:134
static double cauchy(double x, double x0, double gamma)
Calculates the probability density function (PDF) of the Cauchy distribution.
Definition: pdfs.cpp:72
static double student_t(double x, int df)
Calculates the probability density function (PDF) of Student's t distribution.
Definition: pdfs.cpp:179
static double rademacher(int k)
Calculates the probability density function (PDF) of the Rademacher distribution.
Definition: pdfs.cpp:169
static double logistic(double x, double mu, double s)
Calculates the probability density function (PDF) of the logistic distribution.
Definition: pdfs.cpp:139
static double factorial(int n)
Calculates the factorial of an integer.
static double beta_function(double alpha, double beta)
Calculates the beta function.
Definition: pdfs.cpp:212
static double binomial_coefficient(int n, int k)
Calculates the binomial coefficient "n choose k".
Definition: pdfs.cpp:203
The source C++ openGPMP namespace.