openGPMP
Open Source Mathematics Package
describe.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 DESCRIBE_HPP
34 #define DESCRIBE_HPP
35 
36 #include <vector>
37 
38 namespace gpmp {
39 namespace stats {
40 
44 class Describe {
45  public:
53  static double u_stat(const std::vector<double> &sample1,
54  const std::vector<double> &sample2);
55 
62  static double mean_arith(const std::vector<double> &data);
63 
70  double mean_geo(const std::vector<double> &data);
71 
80  double mean_cubic(const std::vector<double> &data, double p);
81 
90  double mean_geo_pow(const std::vector<double> &data, double p);
91 
98  double mean_harmonic(const std::vector<double> &data);
99 
106  double mean_heronian(const std::vector<double> &data);
107 
114  double mean_heinz(const std::vector<double> &data);
115 
124  double mean_lehmer(const std::vector<double> &data, double p);
125 
132  double Median(std::vector<double> data);
139  double avg_abs_dev(const std::vector<double> &data);
140 
147  double var_coeff(const std::vector<double> &data);
148 
155  double iq_range(const std::vector<double> &data);
163  double percentile(const std::vector<double> &data, double percentile);
170  double range(const std::vector<double> &data);
171 
180  static double stdev(const std::vector<double> &data, double mean);
188  static double variance(const std::vector<double> &data, double mean);
189 
201  double clt(const std::vector<double> &data, int numSamples);
202 
212  double kurtosis(const std::vector<double> &data, double mean);
223  double lmoment1(const std::vector<double> &data, double mean);
224 
235  double lmoment2(const std::vector<double> &data, double mean);
246  double
247  skewness(const std::vector<double> &data, double mean, double stddev);
248 
258  std::vector<size_t> rank_data(const std::vector<double> &data);
259 
272  double partial_corr(const std::vector<double> &x,
273  const std::vector<double> &y,
274  const std::vector<double> &z);
285  double ppmc(const std::vector<double> &x, const std::vector<double> &y);
286 
297  double kendalls_tau(const std::vector<double> &x,
298  const std::vector<double> &y);
309  double spearmans_rho(const std::vector<double> &x,
310  const std::vector<double> &y);
311 };
312 
313 } // namespace stats
314 } // namespace gpmp
315 
316 #endif
A class providing methods for descriptive statistics.
Definition: describe.hpp:44
static double u_stat(const std::vector< double > &sample1, const std::vector< double > &sample2)
Calculates U statistic given two samples.
Definition: describe.cpp:38
double kurtosis(const std::vector< double > &data, double mean)
Calculates the kurtosis of a given dataset.
Definition: describe.cpp:212
static double stdev(const std::vector< double > &data, double mean)
Calculates the standard deviation of a given dataset, given the mean.
Definition: describe.cpp:184
double lmoment2(const std::vector< double > &data, double mean)
Calculates the second L-moment of a given dataset.
Definition: describe.cpp:232
double kendalls_tau(const std::vector< double > &x, const std::vector< double > &y)
Calculates Kendall's Tau Rank Correlation between two variables.
Definition: describe.cpp:300
double lmoment1(const std::vector< double > &data, double mean)
Calculates the first L-moment of a given dataset.
Definition: describe.cpp:223
double clt(const std::vector< double > &data, int numSamples)
Calculates the standard error of the mean using the Central Limit Theorem.
Definition: describe.cpp:204
double spearmans_rho(const std::vector< double > &x, const std::vector< double > &y)
Calculates Spearman's Rank Correlation between two variables.
Definition: describe.cpp:322
static double variance(const std::vector< double > &data, double mean)
Calculates the variance of a given dataset, given the mean.
Definition: describe.cpp:194
double mean_lehmer(const std::vector< double > &data, double p)
Calculates the Lehmer mean of a given dataset with a specified power.
Definition: describe.cpp:117
double Median(std::vector< double > data)
Calculates the median of a given dataset.
Definition: describe.cpp:127
double mean_heronian(const std::vector< double > &data)
Calculates the Heronian mean of a given dataset.
Definition: describe.cpp:99
static double mean_arith(const std::vector< double > &data)
Calculates the arithmetic mean of a given dataset.
Definition: describe.cpp:52
double mean_geo_pow(const std::vector< double > &data, double p)
Calculates the power geometric mean of a given dataset with a specified power.
Definition: describe.cpp:80
double percentile(const std::vector< double > &data, double percentile)
Calculates the specified percentile of a given dataset.
Definition: describe.cpp:167
double partial_corr(const std::vector< double > &x, const std::vector< double > &y, const std::vector< double > &z)
Calculates the partial correlation coefficient between two variables, controlling for a third variabl...
Definition: describe.cpp:269
double skewness(const std::vector< double > &data, double mean, double stddev)
Calculates the skewness of a given dataset.
Definition: describe.cpp:242
double iq_range(const std::vector< double > &data)
Calculates the interquartile range of a given dataset.
Definition: describe.cpp:155
std::vector< size_t > rank_data(const std::vector< double > &data)
Ranks the data in ascending order.
Definition: describe.cpp:253
double mean_heinz(const std::vector< double > &data)
Calculates the Heinz mean of a given dataset.
Definition: describe.cpp:108
double mean_cubic(const std::vector< double > &data, double p)
Calculates the cubic generalized mean of a given dataset with a specified power.
Definition: describe.cpp:70
double var_coeff(const std::vector< double > &data)
Calculates the coefficient of variation of a given dataset.
Definition: describe.cpp:148
double mean_harmonic(const std::vector< double > &data)
Calculates the harmonic mean of a given dataset.
Definition: describe.cpp:90
double avg_abs_dev(const std::vector< double > &data)
Calculates the average absolute deviation of a given dataset.
Definition: describe.cpp:138
double ppmc(const std::vector< double > &x, const std::vector< double > &y)
Calculates the Pearson Product-Moment Correlation between two variables.
Definition: describe.cpp:281
double range(const std::vector< double > &data)
Calculates the range of a given dataset.
Definition: describe.cpp:178
double mean_geo(const std::vector< double > &data)
Calculates the geometric mean of a given dataset.
Definition: describe.cpp:61
The source C++ openGPMP namespace.