JKQtPlotter/doc/dox/jkqtcommon_statistics_and_math.dox

106 lines
5.2 KiB
Plaintext

/*!
\defgroup jkqtmath JKQTMath: Special Math and Statistics Utilities
This summarizes all functions from JKQTMath-library, which provides special and advanced math and statistics tools, mostly used by JKQtPlotter.
\defgroup jkqtptools_algorithms General Algorithms (Sorting ...)
\ingroup jkqtmath
\defgroup jkqtptools_math_parser Parser/Evaluator for Mathematical Expressions
\ingroup jkqtmath
In this group there are classes that form a parser and evluator for mathematical expressions.
In the context of the sequencer program this is a tool class that can be used by the classes
in the project. E.g. used by JKQTPXParsedFunctionLineGraph, JKQTPYParsedFunctionLineGraph
\defgroup jkqtptools_math_array Data Array Tools
\ingroup jkqtmath
Functions in this group form the basis for the statistics (\ref jkqtptools_math_statistics ) and linear algebra libraries (\ref jkqtptools_math_linalg ), by providing allocation and freeing of (aligned) memory arrays.
\see JKQTPlotterBasicJKQTPDatastoreStatistics
\defgroup jkqtptools_math_linalg Linear Algebra Tools
\ingroup jkqtmath
This group assembles a basic set of linear algebra methods, including matrix inversion, which are required e.g. by the statistics library (\ref jkqtptools_math_statistics )
\defgroup jkqtptools_math_statistics Statistical Computations
\ingroup jkqtmath
This group contains a statistics library, which offers several basic methods and is based on an iterator interface:
- \ref jkqtptools_math_statistics_basic
- \ref jkqtptools_math_statistics_grouped
- \ref jkqtptools_math_statistics_regression
- \ref jkqtptools_math_statistics_poly
- \ref jkqtptools_math_statistics_1dhist
- \ref jkqtptools_math_statistics_2dhist
- \ref jkqtptools_math_statistics_1dkde
- \ref jkqtptools_math_statistics_2dkde
.
In addition there is a set of "adaptors" (see \ref jkqtptools_math_statistics_adaptors ) that shortcut the calculation of a statistical property and the subsequent parametrization of a plot with the results. With these adaptors you can add e.g. a boxplot or histogram chart to a plot by calling only one function.
All statistics functions use an iterator-based interface, comparable to the interface of the <a href="http://www.cplusplus.com/reference/algorithm/">algorithms in the C++ standard template library</a>. To this end, the class `JKQTPDatastore` provides an iterator interface to its columns, using the functions `JKQTPDatastore::begin()` and `JKQTPDatastore::end()`. Both functions simply receive the column ID as parameter and exist in a const and a mutable variant. the latter allows to also edit the data. In addition the function `JKQTPDatastore::backInserter()` returns a back-inserter iterator (like generated for STL containers with `std::back_inserter(container)`) that also allows to append to the column.
Note that the iterator interface allows to use these functions with any container that provides such iterators (e.g. `std::vector<double>`, `std::list<int>`, `std::set<float>`, `QVector<double>`...).
Code using one of these statistics functions therefore may look e.g. like this:
\code
// mean of a column in a JKQTPDatastore:
double mean=jkqtpstatAverage(datastore1->begin(randomdatacol1), datastore1->end(randomdatacol1));
// mean of a std::vector
std::vector<double> data {1,2,4,5,7,8,10,2,1,3,5};
double meanvec=jkqtpstatAverage(data.begin(), data.end());
\endcode
All statistics functions use all values in the given range and convert each value to a `double`, using `jkqtp_todouble()`. The return values is always a dohble. Therefore you can use these functions to calculate statistics of ranges of any type that can be converted to `double`. Values that do not result in a valid `double`are not used in calculating the statistics. Therefore you can exclude values by setting them `JKQTP_DOUBLE_NAN` (i.e. "not a number").
\see see for detailed examples: \ref JKQTPlotterBasicJKQTPDatastoreStatistics
\defgroup jkqtptools_math_statistics_basic Basic statistics
\ingroup jkqtptools_math_statistics
\defgroup jkqtptools_math_statistics_grouped Grouped statistics
\ingroup jkqtptools_math_statistics
\defgroup jkqtptools_math_statistics_regression Regression Analysis
\ingroup jkqtptools_math_statistics
\defgroup jkqtptools_math_statistics_poly Polynomial Fits/Regression
\ingroup jkqtptools_math_statistics
\defgroup jkqtptools_math_statistics_1dhist 1-dimensional Histograms
\ingroup jkqtptools_math_statistics
\defgroup jkqtptools_math_statistics_2dhist 2-dimensional Histograms
\ingroup jkqtptools_math_statistics
\defgroup jkqtptools_math_statistics_1dkde 1-dimensional Kernel Density Estimates
\ingroup jkqtptools_math_statistics
\defgroup jkqtptools_math_statistics_1dkde_kernels Kernels for 1-dimensional Histograms
\ingroup jkqtptools_math_statistics_1dkde
\defgroup jkqtptools_math_statistics_2dkde 2-dimensional Kernel Density Estimates
\ingroup jkqtptools_math_statistics
\defgroup jkqtptools_math_statistics_2dkde_kernels Kernels for 2-dimensional Histograms
\ingroup jkqtptools_math_statistics_2dkde
\defgroup jkqtptools_math_statistics_adaptors Statistics To Plot Adaptors
\ingroup jkqtptools_math_statistics
\defgroup jkqtmath_libfacilities Library Facilities for JKQTMath
\ingroup jkqtmath
*/