JKQTPlotter trunk/v5.0.0
an extensive Qt5+Qt6 Plotter framework (including a feature-richt plotter widget, a speed-optimized, but limited variant and a LaTeX equation renderer!), written fully in C/C++ and without external dependencies
Loading...
Searching...
No Matches
Collaboration diagram for Statistical Computations:

Modules

 1-dimensional Histograms
 
 1-dimensional Kernel Density Estimates
 
 2-dimensional Histograms
 
 2-dimensional Kernel Density Estimates
 
 Basic statistics
 
 Grouped statistics
 
 Polynomial Fits/Regression
 
 Regression Analysis
 
 Statistics To Plot Adaptors
 

Detailed Description

This group contains a statistics library, which offers several basic methods and is based on an iterator interface:

In addition there is a set of "adaptors" (see Statistics To Plot 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 algorithms in the C++ standard template library. 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:

// 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());
double jkqtpstatAverage(InputIt first, InputIt last, size_t *Noutput=nullptr)
calculates the average of a given data range first ... last
Definition jkqtpstatbasics.h:62

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 doubleare not used in calculating the statistics. Therefore you can exclude values by setting them JKQTP_DOUBLE_NAN (i.e. "not a number").

See also
see for detailed examples: Tutorial (JKQTPDatastore): Advanced 1-Dimensional Statistics with JKQTPDatastore