openGPMP
Open Source Mathematics Package
probdist.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. As this is an Open Source effort, all implementations
25  * must be of the same methodology.
26  *
27  *
28  *
29  * This software is distributed on an AS IS basis, WITHOUT
30  * WARRANTY OF ANY KIND, either express or implied.
31  *
32  ************************************************************************/
33 #ifndef PROBDIST_HPP
34 #define PROBDIST_HPP
35 
36 #include <cmath>
37 #include <vector>
38 
39 namespace gpmp {
40 namespace stats {
41 
42 class ProbDist {
43 
44  public:
50  double quantile_dist(double probability);
59  double normal_PDF(double x, double mean, double stddev);
68  double normal_CDF(double x, double mean, double stddev);
76  double uniform_CDF(size_t k, size_t n);
85  double exp_PDF(double x, size_t k, double lambda);
93  double emp_CDF(const std::vector<double> &data, double x);
101  double emp_PMF(const std::vector<double> &data, double x);
110  double inverse_emp_CDF(const std::vector<double> &data, double p);
111 
118  double mle(const std::vector<double> &data);
119 
126  double mom(const std::vector<double> &data);
132  double mle_est(const std::vector<double> &data);
133 
140  double mumv(const std::vector<double> &data);
146  double median_uniased(const std::vector<double> &data);
147 
155  std::pair<double, double>
156  ConfidenceInterval(const std::vector<double> &data, double alpha);
163  double Pivot(const std::vector<double> &data,
164  double pivotFunction(const std::vector<double> &));
170  double PivotFunctionForConfidenceInterval(const std::vector<double> &data);
179  std::pair<double, double>
180  LikelihoodInterval(const std::vector<double> &data, double alpha);
181 
190  std::pair<double, double>
191  PredictionInterval(const std::vector<double> &data, double alpha);
192 
201  std::pair<double, double> ToleranceInterval(const std::vector<double> &data,
202  double alpha);
203 };
204 
205 } // namespace stats
206 } // namespace gpmp
207 
208 #endif
double exp_PDF(double x, size_t k, double lambda)
Compute the probability density function (PDF) for the exponential distribution.
Definition: probdist.cpp:150
double normal_PDF(double x, double mean, double stddev)
Compute the probability density function (PDF) for the normal distribution.
Definition: probdist.cpp:127
double mle(const std::vector< double > &data)
Compute the Maximum Likelihood Estimate (MLE) for the mean of a dataset.
Definition: probdist.cpp:199
double mle_est(const std::vector< double > &data)
Placeholder function for M-estimation.
Definition: probdist.cpp:220
double emp_CDF(const std::vector< double > &data, double x)
Compute the empirical cumulative distribution function (CDF) for a given value.
Definition: probdist.cpp:168
std::pair< double, double > LikelihoodInterval(const std::vector< double > &data, double alpha)
Compute the likelihood interval for a given dataset and significance level.
Definition: probdist.cpp:294
double Pivot(const std::vector< double > &data, double pivotFunction(const std::vector< double > &))
Compute the value of a pivot function for interval estimation.
Definition: probdist.cpp:271
std::pair< double, double > PredictionInterval(const std::vector< double > &data, double alpha)
Compute the prediction interval for a given dataset and significance level.
Definition: probdist.cpp:310
double normal_CDF(double x, double mean, double stddev)
Compute the cumulative distribution function (CDF) for the normal distribution.
Definition: probdist.cpp:135
double uniform_CDF(size_t k, size_t n)
Compute the cumulative distribution function (CDF) for the uniform distribution.
Definition: probdist.cpp:142
double quantile_dist(double probability)
Compute the quantile of the standard normal distribution.
Definition: probdist.cpp:116
double median_uniased(const std::vector< double > &data)
Compute the median-unbiased estimate for the median of a dataset.
Definition: probdist.cpp:235
double inverse_emp_CDF(const std::vector< double > &data, double p)
Compute the inverse of the empirical cumulative distribution function (CDF) for a given probability.
Definition: probdist.cpp:186
double emp_PMF(const std::vector< double > &data, double x)
Compute the empirical probability mass function (PMF) for a given value.
Definition: probdist.cpp:180
double mom(const std::vector< double > &data)
Compute the method of moments (MOM) estimate for the mean of a dataset.
Definition: probdist.cpp:208
std::pair< double, double > ConfidenceInterval(const std::vector< double > &data, double alpha)
Compute the confidence interval for the mean of a dataset.
Definition: probdist.cpp:253
std::pair< double, double > ToleranceInterval(const std::vector< double > &data, double alpha)
Compute the tolerance interval for a given dataset and significance level.
Definition: probdist.cpp:324
double mumv(const std::vector< double > &data)
Compute the Mean-Unbiased Minimum-Variance (MUMV) estimate for the mean of a dataset.
Definition: probdist.cpp:226
double PivotFunctionForConfidenceInterval(const std::vector< double > &data)
Example pivot function for computing a confidence interval.
Definition: probdist.cpp:282
The source C++ openGPMP namespace.