openGPMP
Open Source Mathematics Package
statistics.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 
34 #ifndef STATISTICS_HPP
35 #define STATISTICS_HPP
36 
37 #include <vector>
38 
39 namespace gpmp {
40 
41 namespace ml {
42 
43 class Stats {
44  public:
45  // These functions are for univariate lin reg module- not for
46  // users.
47  double b0Estimation(const std::vector<double> &x,
48  const std::vector<double> &y);
49  double b1Estimation(const std::vector<double> &x,
50  const std::vector<double> &y);
51  // Statistical Functions
52  double mean(const std::vector<double> &x);
53  double median(std::vector<double> x);
54  std::vector<double> mode(const std::vector<double> &x);
55  double range(const std::vector<double> &x);
56  double midrange(const std::vector<double> &x);
57  double absAvgDeviation(const std::vector<double> &x);
58  double standardDeviation(const std::vector<double> &x);
59  double variance(const std::vector<double> &x);
60  double covariance(const std::vector<double> &x,
61  const std::vector<double> &y);
62  double correlation(const std::vector<double> &x,
63  const std::vector<double> &y);
64  double R2(const std::vector<double> &x, const std::vector<double> &y);
65  double chebyshevIneq(const double k);
66  double weightedMean(const std::vector<double> &x,
67  const std::vector<double> &weights);
68  double geometricMean(const std::vector<double> &x);
69  double harmonicMean(const std::vector<double> &x);
70  double RMS(const std::vector<double> &x);
71  double powerMean(const std::vector<double> &x, const double p);
72  double lehmerMean(const std::vector<double> &x, const double p);
73  double weightedmean_lehmer(const std::vector<double> &x,
74  const std::vector<double> &weights,
75  const double p);
76  double contramean_harmonic(const std::vector<double> &x);
77  double heronianMean(const double A, const double B);
78  double heinzMean(const double A, const double B, const double x);
79  double neumanSandorMean(const double a, const double b);
80  double stolarskyMean(const double x, const double y, const double p);
81  double identricMean(const double x, const double y);
82  double logMean(const double x, const double y);
83 
84  // hypothesis test
85  std::tuple<bool, double> chiSquareTest(std::vector<double> observed,
86  std::vector<double> expected);
87 };
88 
89 } // namespace ml
90 
91 } // namespace gpmp
92 
93 #endif
double RMS(const std::vector< double > &x)
double standardDeviation(const std::vector< double > &x)
double heronianMean(const double A, const double B)
double lehmerMean(const std::vector< double > &x, const double p)
double powerMean(const std::vector< double > &x, const double p)
double median(std::vector< double > x)
double logMean(const double x, const double y)
double correlation(const std::vector< double > &x, const std::vector< double > &y)
double stolarskyMean(const double x, const double y, const double p)
double heinzMean(const double A, const double B, const double x)
double geometricMean(const std::vector< double > &x)
double identricMean(const double x, const double y)
double harmonicMean(const std::vector< double > &x)
double mean(const std::vector< double > &x)
double b1Estimation(const std::vector< double > &x, const std::vector< double > &y)
double R2(const std::vector< double > &x, const std::vector< double > &y)
double chebyshevIneq(const double k)
double range(const std::vector< double > &x)
std::vector< double > mode(const std::vector< double > &x)
double weightedmean_lehmer(const std::vector< double > &x, const std::vector< double > &weights, const double p)
double variance(const std::vector< double > &x)
double b0Estimation(const std::vector< double > &x, const std::vector< double > &y)
double midrange(const std::vector< double > &x)
double weightedMean(const std::vector< double > &x, const std::vector< double > &weights)
double absAvgDeviation(const std::vector< double > &x)
std::tuple< bool, double > chiSquareTest(std::vector< double > observed, std::vector< double > expected)
double neumanSandorMean(const double a, const double b)
double covariance(const std::vector< double > &x, const std::vector< double > &y)
double contramean_harmonic(const std::vector< double > &x)
The source C++ openGPMP namespace.
list A
Definition: linalg.py:22
list B
Definition: linalg.py:23