mirror of
https://github.com/jkriege2/JKQtPlotter.git
synced 2024-12-25 01:51:49 +08:00
bugfixes
This commit is contained in:
parent
356cc34349
commit
ff489e9fac
@ -21,6 +21,8 @@ This software is licensed under the term of the [GNU Lesser General Public Licen
|
||||
- external or internal datasets
|
||||
- complete with GUI (table view)
|
||||
- export capabilities (e.g. to CSV, SYLK, ...)
|
||||
- C++ standard iterator interface
|
||||
- statistics library
|
||||
- large variety of graphs that can be added to a plot, e.g.:
|
||||
- scatter-plots (also parametrized color/size/symbol by a third data-column)
|
||||
- line graphs, step graphs, impulses
|
||||
|
@ -153,7 +153,7 @@ All test-projects are Qt-projects that use qmake to build. You can load them int
|
||||
<tr><td> \image html simpletest_datastore_small.png
|
||||
<td> \subpage JKQTPlotterBasicJKQTPDatastore
|
||||
<td> Basic Data Management with JKQTPDatastore <br/> Copying data into a JKQTPDatastore <br/> Editing data inside a JKQTPDatastore <br/> Editing Image Data in a JKQTPDatastore
|
||||
<tr><td> \image html simpletest_datastore_statistics_small.png
|
||||
<tr><td> \image html jkqtplotter_simpletest_datastore_statistics_small.png
|
||||
<td> \subpage JKQTPlotterBasicJKQTPDatastoreStatistics
|
||||
<td> Advanced 1-Dimensional Statistical Computation with JKQTPODatastore (and the internal statistics library, see \ref jkqtptools_math_statistics )
|
||||
</table>
|
||||
|
@ -64,7 +64,7 @@ All test-projects are Qt-projects that use qmake to build. You can load them int
|
||||
| Screenshot | Description | Notes |
|
||||
|:-------------:| ------------- | ------------- |
|
||||
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/simpletest_datastore_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_datastore) | [Tutorial: Basic Usage of JKQTPDatastore](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_datastore) | Basic Data Management with JKQTPDatastore <br/> Copying data into a JKQTPDatastore <br/> Editing data inside a JKQTPDatastore <br/> Editing Image Data in a JKQTPDatastore |
|
||||
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/simpletest_datastore_statistics_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_datastore_statistics) | [Tutorial: Advanced 1-Dimensional Statistics with JKQTPDatastore](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_datastore_statistics) | Advanced 1-Dimensional Statistical Computation with JKQTPDatastore (and the internal statistics library) |
|
||||
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_datastore_statistics_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_datastore_statistics) | [Tutorial: Advanced 1-Dimensional Statistics with JKQTPDatastore](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_datastore_statistics) | Advanced 1-Dimensional Statistical Computation with JKQTPDatastore (and the internal statistics library) |
|
||||
|
||||
|
||||
## More Complex Examples
|
||||
|
@ -49,6 +49,7 @@ RESOURCES += jkqtplot_test.qrc
|
||||
|
||||
|
||||
win32-msvc*: DEFINES += _USE_MATH_DEFINES
|
||||
win32-msvc*: DEFINES += NOMINMAX
|
||||
|
||||
TARGET = jkqtplot_test
|
||||
|
||||
|
@ -20,6 +20,7 @@ CONFIG (debug, debug|release) {
|
||||
message("LIBS = $$LIBS")
|
||||
|
||||
win32-msvc*: DEFINES += _USE_MATH_DEFINES
|
||||
win32-msvc*: DEFINES += NOMINMAX
|
||||
|
||||
|
||||
|
||||
|
@ -29,6 +29,8 @@ win32-msvc* {
|
||||
# To fix error: C2338: va_start argument must not
|
||||
# have reference type and must not be parenthesized
|
||||
DEFINES += _CRT_NO_VA_START_VALIDATION
|
||||
# fix errors with min()/max() macros from windows
|
||||
DEFINES += NOMINMAX
|
||||
}
|
||||
|
||||
|
||||
|
@ -20,6 +20,7 @@ CONFIG (debug, debug|release) {
|
||||
message("LIBS = $$LIBS")
|
||||
|
||||
win32-msvc*: DEFINES += _USE_MATH_DEFINES
|
||||
win32-msvc*: DEFINES += NOMINMAX
|
||||
|
||||
|
||||
|
||||
|
@ -7,7 +7,7 @@ This tutorial project (see `./examples/simpletest_datastore_statistics/`) explai
|
||||
The source code of the main application can be found in [`jkqtplotter_simpletest_datastore_statistics.cpp`](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_datastore_statistics/jkqtplotter_simpletest_datastore_statistics.cpp).
|
||||
This tutorial cites only parts of this code to demonstrate different ways of working with data for the graphs.
|
||||
|
||||
## Generating different sets of random numbers
|
||||
# Generating different sets of random numbers
|
||||
|
||||
The code segments below will fill four instances of JKQTPlotter with different statistical plots. All these plots are based on three sets of random numbers generated as shown here:
|
||||
```.cpp
|
||||
@ -34,7 +34,7 @@ The column `randomdatacol1` will contain 150 random numbers. Each one is drawn e
|
||||
The three columns are generated empyt by calling `JKQTPDatastore::addColumn()` with only a name. Then the actual values are added by calling `JKQTPDatastore::appendToColumn()`.
|
||||
|
||||
|
||||
## Basic Statistics
|
||||
# Basic Statistics
|
||||
|
||||
The three sets of random numbers from above can be visualized e.g. by a `JKQTPPeakStreamGraph` graph with code as follows:
|
||||
```.cpp
|
||||
@ -82,9 +82,9 @@ Of course, several other functions exist that calculate basic statistics from a
|
||||
All these 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").
|
||||
|
||||
|
||||
## Boxplots
|
||||
# Boxplots
|
||||
|
||||
### Standard Boxplots
|
||||
## Standard Boxplots
|
||||
|
||||
As mentioned above and shown in several other examples, JKQTPlotter supports [Boxplots](https://en.wikipedia.org/wiki/Box_plot) with the classes `JKQTPBoxplotHorizontalElement`, `JKQTPBoxplotVerticalElement`, as well as `JKQTPBoxplotHorizontal` and `JKQTPBoxplotVertical`. You can then use the 5-Number Summray functions from the statistics library to calculate the data for such a boxplot (e.g. `jkqtpstat5NumberStatistics()`) and set it up by hand. Code would look roughly like this:
|
||||
```.cpp
|
||||
@ -118,7 +118,7 @@ Here `-0.25`indicates the location (on the y-axis) of the boxplot. and the plot
|
||||
|
||||
![jkqtplotter_simpletest_datastore_statistics_boxplots_simple](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_datastore_statistics_boxplots_simple.png)
|
||||
|
||||
### Boxplots with Outliers
|
||||
## Boxplots with Outliers
|
||||
|
||||
Usually the boxplot draws its whiskers at the minimum and maximum value of the dataset. But if your data contains a lot of outliers, it may make sense to draw them e.g. at the 3% and 97% quantiles and the draw the outliers as additional data points. This can also be done with `jkqtpstat5NumberStatistics()`, as you can specify the minimum and maximum quantile (default is 0 and 1, i.e. the true minimum and maximum) and the resulting object contains a vector with the outlier values. Then you could add them to the JKQTPDatastore and add a scatter plot that displays them. Also this task is sped up by an "adaptor". Simply call
|
||||
|
||||
@ -136,7 +136,7 @@ As you can see this restuns the `JKQTPBoxplotHorizontalElement` and in addition
|
||||
|
||||
|
||||
|
||||
## Histograms
|
||||
# Histograms
|
||||
|
||||
Calculating 1D-Histograms is supported by several functions from the statistics library, e.g. `jkqtpstatHistogram1DAutoranged()`. You can use the result to fill new columns in a `JKQTPDatastore`, which can then be used to draw the histogram (here wit 15 bins, spanning the full data range):
|
||||
|
||||
@ -163,7 +163,7 @@ The resulting plot looks like this (the distributions used to generate the rando
|
||||
|
||||
|
||||
|
||||
## Kernel Density Estimates (KDE)
|
||||
# Kernel Density Estimates (KDE)
|
||||
|
||||
Especially when only few samples from a distribution are available, histograms are not good at representing the underlying data distribution. In such cases, [Kernel Density Estimates (KDE)](https://en.wikipedia.org/wiki/Kernel_density_estimation) can help, which are basically a smoothed variant of a histogram. The statistics library supports calculating them via e.g. `jkqtpstatKDE1D()`:
|
||||
|
||||
@ -210,7 +210,7 @@ Plots that result from such calls look like this:
|
||||
![jkqtplotter_simpletest_datastore_statistics_kde](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_datastore_statistics_kde.png)
|
||||
|
||||
|
||||
## Cummulative Histograms and KDEs
|
||||
# Cummulative Histograms and KDEs
|
||||
|
||||
Both histograms and KDEs support a parameter `bool cummulative`, which allows to accumulate the data after calculation and drawing cummulative histograms/KDEs:
|
||||
|
||||
@ -226,7 +226,7 @@ Both histograms and KDEs support a parameter `bool cummulative`, which allows to
|
||||
|
||||
|
||||
|
||||
## Screenshot of the full Program
|
||||
# Screenshot of the full Program
|
||||
|
||||
The output of the full test program [`jkqtplotter_simpletest_datastore_statistics.cpp`](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_datastore_statistics/jkqtplotter_simpletest_datastore_statistics.cpp) looks like this:
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/** \example jkqtplotter_simpletest_datastore_statistics.cpp
|
||||
* Explains how to use the internal statistics library (see \ref jkqtptools_statistics ) together with JKQTPDatastore to generate advanced plots for 1-dimensional data.
|
||||
*
|
||||
* \ref JKQTPlottersimpletest_datastore_statistics
|
||||
* \ref JKQTPlotterBasicJKQTPDatastoreStatistics
|
||||
*/
|
||||
|
||||
#include <QApplication>
|
||||
|
@ -20,6 +20,7 @@ CONFIG (debug, debug|release) {
|
||||
message("LIBS = $$LIBS")
|
||||
|
||||
win32-msvc*: DEFINES += _USE_MATH_DEFINES
|
||||
win32-msvc*: DEFINES += NOMINMAX
|
||||
|
||||
|
||||
|
||||
|
@ -21,6 +21,7 @@ CONFIG (debug, debug|release) {
|
||||
message("LIBS = $$LIBS")
|
||||
|
||||
win32-msvc*: DEFINES += _USE_MATH_DEFINES
|
||||
win32-msvc*: DEFINES += NOMINMAX
|
||||
|
||||
|
||||
|
||||
|
@ -31,6 +31,8 @@ message("LIBS = $$LIBS")
|
||||
# To fix error: C2338: va_start argument must not
|
||||
# have reference type and must not be parenthesized
|
||||
DEFINES += _CRT_NO_VA_START_VALIDATION
|
||||
# fix errors with min()/max() macros from windows
|
||||
DEFINES += NOMINMAX
|
||||
}
|
||||
|
||||
|
||||
|
@ -21,6 +21,7 @@ CONFIG (debug, debug|release) {
|
||||
message("LIBS = $$LIBS")
|
||||
|
||||
win32-msvc*: DEFINES += _USE_MATH_DEFINES
|
||||
win32-msvc*: DEFINES += NOMINMAX
|
||||
|
||||
|
||||
|
||||
|
@ -21,6 +21,7 @@ CONFIG (debug, debug|release) {
|
||||
message("LIBS = $$LIBS")
|
||||
|
||||
win32-msvc*: DEFINES += _USE_MATH_DEFINES
|
||||
win32-msvc*: DEFINES += NOMINMAX
|
||||
|
||||
|
||||
|
||||
|
@ -21,6 +21,7 @@ CONFIG (debug, debug|release) {
|
||||
message("LIBS = $$LIBS")
|
||||
|
||||
win32-msvc*: DEFINES += _USE_MATH_DEFINES
|
||||
win32-msvc*: DEFINES += NOMINMAX
|
||||
|
||||
|
||||
|
||||
|
@ -23,6 +23,7 @@ CONFIG (debug, debug|release) {
|
||||
message("LIBS = $$LIBS")
|
||||
|
||||
win32-msvc*: DEFINES += _USE_MATH_DEFINES
|
||||
win32-msvc*: DEFINES += NOMINMAX
|
||||
|
||||
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
# Example (JKQTPlotter): Plotting Parsed Mathematical Functions as Line Graphs {#JKQTPlotterParsedFunctionPlot}
|
||||
## Plot Function f(x)
|
||||
|
||||
# Plot Function f(x)
|
||||
|
||||
This project (see `./examples/simpletest_parsedfunctionplot/`) demonstrates how to plot mathematical functions as line graphs. The functions are defined as strings that will be evaluated with the equation parser, integrated into JKQTPlotter.
|
||||
|
||||
Note: See the example [Plotting Mathematical Functions as Line Graphs](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_functionplot) if you don't want to draw parsed functions, but want to provide a C function, or C++ functor!
|
||||
@ -44,7 +46,8 @@ This code snippet results in a plot like this:
|
||||
|
||||
![jkqtplotter_simpletest_parsedfunctionplot](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_parsedfunctionplot.png)
|
||||
|
||||
## Plotting with parameters
|
||||
# Plotting with parameters
|
||||
|
||||
As shown in [Plotting Mathematical Functions as Line Graphs](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_functionplot) you can also use externally set parameters in a plot function. These parameters can be double numbers and may be set with either as an internal parameter vector, or may be read from a parameter column (as shown in the [linked example](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_functionplot)). These parameters are available as variables `p1`, `p2`, ... in the function string. Here is a small example:
|
||||
|
||||
```.cpp
|
||||
@ -54,13 +57,15 @@ As shown in [Plotting Mathematical Functions as Line Graphs](https://github.com/
|
||||
parsedFunc->setTitle("user function");
|
||||
```
|
||||
|
||||
## Plot Function f(y)
|
||||
# Plot Function f(y)
|
||||
|
||||
If you use the graph class `JKQTPYParsedFunctionLineGraph` instead of `JKQTPXParsedFunctionLineGraph`, you can plot functions `x=f(y)` (instead of `y=f(x)`). The function from the example above will then ahve to be changed to `sin(y*8)*exp(-y/4)` and the result will look like this:
|
||||
|
||||
![jkqtplotter_simpletest_parsedfunctionplot_fy](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_parsedfunctionplot_fy.png)
|
||||
|
||||
|
||||
## Properties of the Adaptive Plotting Algorithm
|
||||
# Properties of the Adaptive Plotting Algorithm
|
||||
|
||||
The adaptive capabilities of the rendering algorithm can be seen, when plotting e.g. `2/x`, which is drawn smoothely, even around the undefined value at `x=0`:
|
||||
|
||||
![jkqtplotter_simpletest_parsedfunctionplot_2overx.png](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_parsedfunctionplot_2overx.png)
|
||||
|
@ -21,6 +21,7 @@ CONFIG (debug, debug|release) {
|
||||
message("LIBS = $$LIBS")
|
||||
|
||||
win32-msvc*: DEFINES += _USE_MATH_DEFINES
|
||||
win32-msvc*: DEFINES += NOMINMAX
|
||||
|
||||
|
||||
|
||||
|
@ -21,6 +21,7 @@ CONFIG (debug, debug|release) {
|
||||
message("LIBS = $$LIBS")
|
||||
|
||||
win32-msvc*: DEFINES += _USE_MATH_DEFINES
|
||||
win32-msvc*: DEFINES += NOMINMAX
|
||||
|
||||
|
||||
|
||||
|
@ -21,6 +21,7 @@ CONFIG (debug, debug|release) {
|
||||
message("LIBS = $$LIBS")
|
||||
|
||||
win32-msvc*: DEFINES += _USE_MATH_DEFINES
|
||||
win32-msvc*: DEFINES += NOMINMAX
|
||||
|
||||
|
||||
|
||||
|
@ -21,6 +21,7 @@ CONFIG (debug, debug|release) {
|
||||
message("LIBS = $$LIBS")
|
||||
|
||||
win32-msvc*: DEFINES += _USE_MATH_DEFINES
|
||||
win32-msvc*: DEFINES += NOMINMAX
|
||||
|
||||
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Tutorial (JKQTPlotter): Using a JKQTPlotter inside a Qt User Interface Designer (UI) File {#JKQTPlotterQtCreator}
|
||||
This project (see `./examples/simpletest_ui/`) demonstrates how to create add a `JKQTPlotter` inside the Qt Form Editor (e.g. called from of Qt Creator) into a widget.
|
||||
|
||||
## Instructions on how to use JKQTPlotter in the Qt Form Designer
|
||||
# Instructions on how to use JKQTPlotter in the Qt Form Designer
|
||||
|
||||
For this to work you have to follow the steps shown below:
|
||||
|
||||
@ -16,7 +16,7 @@ For this to work you have to follow the steps shown below:
|
||||
|
||||
|
||||
|
||||
## QMake-Project of this example
|
||||
# QMake-Project of this example
|
||||
|
||||
The QMake project for such a project looks like this (see [`jkqtplotter_simpletest_ui.pro`](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_ui/jkqtplotter_simpletest_ui.pro):
|
||||
```.qmake
|
||||
@ -47,6 +47,7 @@ CONFIG (debug, debug|release) {
|
||||
message("LIBS = $$LIBS")
|
||||
|
||||
win32-msvc*: DEFINES += _USE_MATH_DEFINES
|
||||
win32-msvc*: DEFINES += NOMINMAX
|
||||
|
||||
|
||||
|
||||
@ -73,7 +74,7 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
```
|
||||
|
||||
## Form Class `FormWithJKQTPlotter`
|
||||
# Form Class `FormWithJKQTPlotter`
|
||||
|
||||
The Form was designed in the Qt Form Designer within Qt Creator, using the method described above (see `formwithjkqtplotter.ui`):
|
||||
|
||||
|
@ -25,6 +25,7 @@ CONFIG (debug, debug|release) {
|
||||
message("LIBS = $$LIBS")
|
||||
|
||||
win32-msvc*: DEFINES += _USE_MATH_DEFINES
|
||||
win32-msvc*: DEFINES += NOMINMAX
|
||||
|
||||
|
||||
|
||||
|
@ -29,6 +29,8 @@ win32-msvc* {
|
||||
# To fix error: C2338: va_start argument must not
|
||||
# have reference type and must not be parenthesized
|
||||
DEFINES += _CRT_NO_VA_START_VALIDATION
|
||||
# fix errors with min()/max() macros from windows
|
||||
DEFINES += NOMINMAX
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,7 +2,8 @@
|
||||
|
||||
[TOC]
|
||||
|
||||
## Basic Description
|
||||
# Basic Description
|
||||
|
||||
This project (see `./examples/test_styling/`) demonstrates different types of user-interactions in JKQTPlotter.
|
||||
|
||||
It contains a simple plot with two graphs and provides several widgets that allow to modify the plot styling by editing an INI file:
|
||||
@ -10,9 +11,10 @@ It contains a simple plot with two graphs and provides several widgets that allo
|
||||
![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/test_styling.png)
|
||||
|
||||
|
||||
## Altering the Default Style
|
||||
# Altering the Default Style
|
||||
|
||||
## Global/System-wide Settings
|
||||
|
||||
### Global/System-wide Settings
|
||||
The `main()`-function can be found in [`test_styling_main.cpp`](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/test_styling/test_styling_main.cpp). Here the Qt application is initialized in the usual way and the main window `win` is created and shown. After instanciating the `QApplication`, but befor instanciating the window (and thus the JKQTPlotter), you can already alter the system-wide default styling. It is accessible via the function `JKQTPGetSystemDefaultStyle()`, which returns a reference to the central style object of type `JKQTPlotterStyle`. In the example below, the color of the user-actions (e.g. of the zooming rectangle, that can be drawn with the mouse) is set to red:
|
||||
|
||||
```.cpp
|
||||
@ -41,7 +43,7 @@ You can also store these settings in an INI-file (or any file supported by [`QSe
|
||||
JKQTPGetSystemDefaultBaseStyle().loadSettings(plotSettings);
|
||||
```
|
||||
|
||||
### Apply a new Style to an Existing JKQTPlotter
|
||||
## Apply a new Style to an Existing JKQTPlotter
|
||||
|
||||
The major part of the source code of the main application can be found in [`test_styling.cpp`](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/test_styling/test_styling.cpp). It opens a window with a plotter, that contains a set of test graphs to demonstrate the styling. The following function is connected to the "Update Graph"-button and applys the style defined by the INI in the plainTextEdit to the plotter:
|
||||
```.cpp
|
||||
@ -71,7 +73,7 @@ The major part of the source code of the main application can be found in [`tes
|
||||
```
|
||||
|
||||
|
||||
## Some Example Styles
|
||||
# Some Example Styles
|
||||
The following gallery shows a set of example styles:
|
||||
|
||||
|
||||
|
@ -39,6 +39,8 @@ win32-msvc* {
|
||||
# To fix error: C2338: va_start argument must not
|
||||
# have reference type and must not be parenthesized
|
||||
DEFINES += _CRT_NO_VA_START_VALIDATION
|
||||
# fix errors with min()/max() macros from windows
|
||||
DEFINES += NOMINMAX
|
||||
}
|
||||
|
||||
|
||||
|
@ -32,6 +32,8 @@ win32-msvc* {
|
||||
# To fix error: C2338: va_start argument must not
|
||||
# have reference type and must not be parenthesized
|
||||
DEFINES += _CRT_NO_VA_START_VALIDATION
|
||||
# fix errors with min()/max() macros from windows
|
||||
DEFINES += NOMINMAX
|
||||
}
|
||||
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "jkqtcommon/jkqtpmathparser.h" // class's header file
|
||||
#include <iostream>
|
||||
#include <float.h>
|
||||
#include <ctime>
|
||||
#include "jkqtcommon/jkqtpstringtools.h"
|
||||
|
||||
/* This just distinguishes between the different path formats on Windows and Unix:
|
||||
|
@ -23,6 +23,7 @@
|
||||
#define jkqtpmathtools_H_INCLUDED
|
||||
#include "jkqtcommon/jkqtp_imexport.h"
|
||||
#include <cmath>
|
||||
#include <limits>
|
||||
#include <QPoint>
|
||||
#include <QPointF>
|
||||
#include <vector>
|
||||
|
@ -718,7 +718,7 @@ inline double jkqtpstatMoment(InputIt first, InputIt last, int order, size_t* No
|
||||
|
||||
|
||||
|
||||
/*! \briefcalculate empirical (Pearson's) correlation coefficient between two given data ranges \a first1 ... \a last1 and \a first2 ... \a last2
|
||||
/*! \brief calculate empirical (Pearson's) correlation coefficient between two given data ranges \a first1 ... \a last1 and \a first2 ... \a last2
|
||||
\ingroup jkqtptools_math_statistics_basic
|
||||
|
||||
\tparam InputIt1 standard iterator type of \a first1 and \a last1.
|
||||
@ -839,7 +839,7 @@ inline double jkqtpstatMedianOfSortedVector(const TVector& data, size_t* Noutput
|
||||
Entries in the range that are invalid double (using JKQTPIsOKFloat() )
|
||||
are ignored when calculating.
|
||||
|
||||
\see https://en.wikipedia.org/wiki/Five-number_summary, jkqtpstatAddVBoxplotAndOutliers, jkqtpstatAddHBoxplotAndOutliers, jkqtpstatAddVBoxplot, jkqtpstatAddHBoxplot, \ref JKQTPlottersimpletest_datastore_statistics
|
||||
\see https://en.wikipedia.org/wiki/Five-number_summary, jkqtpstatAddVBoxplotAndOutliers, jkqtpstatAddHBoxplotAndOutliers, jkqtpstatAddVBoxplot, jkqtpstatAddHBoxplot, \ref JKQTPlotterBasicJKQTPDatastoreStatistics
|
||||
*/
|
||||
template <class TVector>
|
||||
inline void jkqtpstat5NumberStatisticsOfSortedVector(const TVector& data, double* minimum=nullptr, double minimumQuantile=0, double* median=nullptr, double* maximum=nullptr, double maximumQuantile=1, double* quantile1=nullptr, double quantile1Spec=0.25, double* quantile2=nullptr, double quantile2Spec=0.75, double* IQR=nullptr, double* IQRSignificance=nullptr, size_t* Noutput=nullptr) {
|
||||
@ -902,7 +902,7 @@ inline void jkqtpstat5NumberStatisticsOfSortedVector(const TVector& data, double
|
||||
Entries in the range that are invalid double (using JKQTPIsOKFloat() )
|
||||
are ignored when calculating.
|
||||
|
||||
\see https://en.wikipedia.org/wiki/Five-number_summary, jkqtpstatAddVBoxplotAndOutliers, jkqtpstatAddHBoxplotAndOutliers, jkqtpstatAddVBoxplot, jkqtpstatAddHBoxplot, \ref JKQTPlottersimpletest_datastore_statistics
|
||||
\see https://en.wikipedia.org/wiki/Five-number_summary, jkqtpstatAddVBoxplotAndOutliers, jkqtpstatAddHBoxplotAndOutliers, jkqtpstatAddVBoxplot, jkqtpstatAddHBoxplot, \ref JKQTPlotterBasicJKQTPDatastoreStatistics
|
||||
*/
|
||||
template <class TVector, class OutputIt>
|
||||
inline void jkqtpstat5NumberStatisticsAndOutliersOfSortedVector(const TVector& data, OutputIt outliersout, double* minimum=nullptr, double minimumQuantile=0, double* median=nullptr, double* maximum=nullptr, double maximumQuantile=1, double* quantile1=nullptr, double quantile1Spec=0.25, double* quantile2=nullptr, double quantile2Spec=0.75, double* IQR=nullptr, double* IQRSignificance=nullptr, size_t* Noutput=nullptr) {
|
||||
@ -971,7 +971,7 @@ inline void jkqtpstat5NumberStatisticsAndOutliersOfSortedVector(const TVector& d
|
||||
Entries in the range that are invalid double (using JKQTPIsOKFloat() )
|
||||
are ignored when calculating.
|
||||
|
||||
\see https://en.wikipedia.org/wiki/Five-number_summary, jkqtpstatAddVBoxplotAndOutliers, jkqtpstatAddHBoxplotAndOutliers, jkqtpstatAddVBoxplot, jkqtpstatAddHBoxplot, \ref JKQTPlottersimpletest_datastore_statistics
|
||||
\see https://en.wikipedia.org/wiki/Five-number_summary, jkqtpstatAddVBoxplotAndOutliers, jkqtpstatAddHBoxplotAndOutliers, jkqtpstatAddVBoxplot, jkqtpstatAddHBoxplot, \ref JKQTPlotterBasicJKQTPDatastoreStatistics
|
||||
*/
|
||||
template <class InputIt>
|
||||
inline void jkqtpstat5NumberStatistics(InputIt first, InputIt last, double* minimum=nullptr, double minimumQuantile=0, double* median=nullptr, double* maximum=nullptr, double maximumQuantile=1, double quantile1Spec=0.25, double* quantile1=nullptr, double quantile2Spec=0.75, double* quantile2=nullptr, double* IQR=nullptr, double* IQRSignificance=nullptr, size_t* Noutput=nullptr) {
|
||||
@ -1008,7 +1008,7 @@ inline void jkqtpstat5NumberStatistics(InputIt first, InputIt last, double* mini
|
||||
Entries in the range that are invalid double (using JKQTPIsOKFloat() )
|
||||
are ignored when calculating.
|
||||
|
||||
\see https://en.wikipedia.org/wiki/Five-number_summary, jkqtpstatAddVBoxplotAndOutliers, jkqtpstatAddHBoxplotAndOutliers, jkqtpstatAddVBoxplot, jkqtpstatAddHBoxplot, \ref JKQTPlottersimpletest_datastore_statistics
|
||||
\see https://en.wikipedia.org/wiki/Five-number_summary, jkqtpstatAddVBoxplotAndOutliers, jkqtpstatAddHBoxplotAndOutliers, jkqtpstatAddVBoxplot, jkqtpstatAddHBoxplot, \ref JKQTPlotterBasicJKQTPDatastoreStatistics
|
||||
*/
|
||||
template <class InputIt, class OutputIt>
|
||||
inline void jkqtpstat5NumberStatisticsAndOutliers(InputIt first, InputIt last, OutputIt outliersout, double* minimum=nullptr, double minimumQuantile=0, double* median=nullptr, double* maximum=nullptr, double maximumQuantile=1, double* quantile1=nullptr, double quantile1Spec=0.25, double* quantile2=nullptr, double quantile2Spec=0.75, double* IQR=nullptr, double* IQRSignificance=nullptr, size_t* Noutput=nullptr) {
|
||||
@ -1071,7 +1071,7 @@ struct JKQTPStat5NumberStatistics {
|
||||
Entries in the range that are invalid double (using JKQTPIsOKFloat() )
|
||||
are ignored when calculating.
|
||||
|
||||
\see https://en.wikipedia.org/wiki/Five-number_summary, jkqtpstatAddVBoxplotAndOutliers, jkqtpstatAddHBoxplotAndOutliers, jkqtpstatAddVBoxplot, jkqtpstatAddHBoxplot, \ref JKQTPlottersimpletest_datastore_statistics
|
||||
\see https://en.wikipedia.org/wiki/Five-number_summary, jkqtpstatAddVBoxplotAndOutliers, jkqtpstatAddHBoxplotAndOutliers, jkqtpstatAddVBoxplot, jkqtpstatAddHBoxplot, \ref JKQTPlotterBasicJKQTPDatastoreStatistics
|
||||
*/
|
||||
template <class InputIt>
|
||||
inline JKQTPStat5NumberStatistics jkqtpstat5NumberStatistics(InputIt first, InputIt last, double quantile1Spec=0.25, double quantile2Spec=0.75, double minimumQuantile=0, double maximumQuantile=1.0) {
|
||||
@ -1425,6 +1425,379 @@ inline void jkqtpstatHistogram1D(InputIt first, InputIt last, BinsInputIt binsFi
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*! \brief a 1D Gaussian kernel function, e.g. for Kernel Density Estimation
|
||||
\ingroup jkqtptools_math_statistics_1dkde
|
||||
|
||||
\f[ k(t):=\frac{1}{\sqrt{2\pi}}\exp \left(-\frac{1}{2}t^2\right) \f]
|
||||
*/
|
||||
JKQTP_LIB_EXPORT double jkqtpstatKernel1DGaussian(double t);
|
||||
/*! \brief a 1D Cauchy kernel function, e.g. for Kernel Density Estimation
|
||||
\ingroup jkqtptools_math_statistics_1dkde
|
||||
|
||||
\f[ k(t):=\frac{1}{\pi(1+t^2)} \f]
|
||||
*/
|
||||
JKQTP_LIB_EXPORT double jkqtpstatKernel1DCauchy(double t);
|
||||
|
||||
/*! \brief a 1D Picard kernel function, e.g. for Kernel Density Estimation
|
||||
\ingroup jkqtptools_math_statistics_1dkde
|
||||
|
||||
\f[ k(t):=\frac{1}{2}\exp(-|t|) \f]
|
||||
*/
|
||||
JKQTP_LIB_EXPORT double jkqtpstatKernel1DPicard(double t);
|
||||
/*! \brief a 1D Epanechnikov kernel function, e.g. for Kernel Density Estimation
|
||||
\ingroup jkqtptools_math_statistics_1dkde
|
||||
|
||||
\f[ k(t) :=\begin{cases}\frac{3}{4} ( 1- t^2 ), & \text{if }t\in [-1;1]\\0, & \text{else}\end{cases} \f]
|
||||
*/
|
||||
JKQTP_LIB_EXPORT double jkqtpstatKernel1DEpanechnikov(double t);
|
||||
/*! \brief a 1D uniform kernel function, e.g. for Kernel Density Estimation
|
||||
\ingroup jkqtptools_math_statistics_1dkde
|
||||
|
||||
\f[ k(t) :=\begin{cases}1, & \text{if }t\in [-1;1]\\0, & \text{else}\end{cases} \f]
|
||||
*/
|
||||
JKQTP_LIB_EXPORT double jkqtpstatKernel1DUniform(double t);
|
||||
/*! \brief a 1D Epanechnikov kernel function, e.g. for Kernel Density Estimation
|
||||
\ingroup jkqtptools_math_statistics_1dkde
|
||||
|
||||
\f[ k(t) :=\begin{cases}1-|t|, & \text{if }t\in [-1;1]\\0, & \text{else}\end{cases} \f]
|
||||
*/
|
||||
JKQTP_LIB_EXPORT double jkqtpstatKernel1DTriangle(double t);
|
||||
|
||||
/*! \brief a 1D quartic kernel function, e.g. for Kernel Density Estimation
|
||||
\ingroup jkqtptools_math_statistics_1dkde
|
||||
|
||||
\f[ k(t) :=\begin{cases}\frac{15}{16}(1-t^2)^2, & \text{if }t\in [-1;1]\\0, & \text{else}\end{cases} \f]
|
||||
*/
|
||||
JKQTP_LIB_EXPORT double jkqtpstatKernel1DQuartic(double t);
|
||||
/*! \brief a 1D triweight kernel function, e.g. for Kernel Density Estimation
|
||||
\ingroup jkqtptools_math_statistics_1dkde
|
||||
|
||||
\f[ k(t) :=\begin{cases}\frac{35}{32}(1-t^2)^3, & \text{if }t\in [-1;1]\\0, & \text{else}\end{cases} \f]
|
||||
*/
|
||||
JKQTP_LIB_EXPORT double jkqtpstatKernel1DTriweight(double t);
|
||||
|
||||
/*! \brief a 1D tricube kernel function, e.g. for Kernel Density Estimation
|
||||
\ingroup jkqtptools_math_statistics_1dkde
|
||||
|
||||
\f[ k(t) :=\begin{cases}\frac{70}{81}(1-|t|^3)^3, & \text{if }t\in [-1;1]\\0, & \text{else}\end{cases} \f]
|
||||
*/
|
||||
JKQTP_LIB_EXPORT double jkqtpstatKernel1DTricube(double t);
|
||||
/*! \brief a 1D cosine kernel function, e.g. for Kernel Density Estimation
|
||||
\ingroup jkqtptools_math_statistics_1dkde
|
||||
|
||||
\f[ k(t) :=\begin{cases}\frac{\pi}{4}\cos\left(\frac{\pi}{2}t\right), & \text{if }t\in [-1;1]\\0, & \text{else}\end{cases} \f]
|
||||
*/
|
||||
JKQTP_LIB_EXPORT double jkqtpstatKernel1DCosine(double t);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*! \brief a 1D Gaussian kernel function, e.g. for Kernel Density Estimation
|
||||
\ingroup jkqtptools_math_statistics_2dkde
|
||||
|
||||
\f[ k(t_x, t_y):=\frac{1}{2\pi}\exp \left(-\frac{t_x^2+t_y^2}{2}\right) \f]
|
||||
*/
|
||||
JKQTP_LIB_EXPORT double jkqtpstatKernel2DGaussian(double tx, double ty);
|
||||
|
||||
/*! \brief a 1D Gaussian kernel function, e.g. for Kernel Density Estimation
|
||||
\ingroup jkqtptools_math_statistics_2dkde
|
||||
|
||||
\f[ k(t_x, t_y):=\begin{cases}\frac{1}{4}, & \text{if }t_x,t_y\in [-1;1]\\0, & \text{else}\end{cases} \f]
|
||||
*/
|
||||
JKQTP_LIB_EXPORT double jkqtpstatKernel2DUniform(double tx, double ty);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*! \brief estimates a bandwidth for a Kernel Density Estimator (KDE) of the given data \a first ... \a last
|
||||
\ingroup jkqtptools_math_statistics_1dkde
|
||||
|
||||
evaluates \f[ h = \left(\frac{4\hat{\sigma}^5}{3n}\right)^{\frac{1}{5}} \approx 1.06 \hat{\sigma} n^{-1/5} \f]
|
||||
|
||||
\tparam InputIt standard iterator type of \a first and \a last.
|
||||
\param first iterator pointing to the first item in the dataset to use \f$ X_1 \f$
|
||||
\param last iterator pointing behind the last item in the dataset to use \f$ X_N \f$
|
||||
\return the estimated bandwidth
|
||||
|
||||
*/
|
||||
template <class InputIt>
|
||||
inline double jkqtpstatEstimateKDEBandwidth(InputIt first, InputIt last) {
|
||||
size_t N=0;
|
||||
const double sigma=jkqtpstatStdDev(first, last, nullptr, &N);
|
||||
return 1.06*sigma/pow(static_cast<double>(N), 1.0/5.0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*! \brief evaluates the Kernel Density Estimator (KDE) at a given position
|
||||
\ingroup jkqtptools_math_statistics_1dkde
|
||||
|
||||
evaluates \f[ \tilde{f}(t):=\frac{1}{N\cdot\text{bandwidth}}\cdot\sum\limits_{i=0}^{N-1}K\left(\frac{t-x_i}{\text{bandwidth}}\right) \f]
|
||||
|
||||
\tparam InputIt standard iterator type of \a first and \a last.
|
||||
\param t where to evaluate the kernel sum
|
||||
\param first iterator pointing to the first item in the dataset to use \f$ X_1 \f$
|
||||
\param last iterator pointing behind the last item in the dataset to use \f$ X_N \f$
|
||||
\param kernel the kernel function to use (e.g. jkqtpstatKernel1DGaussian() )
|
||||
\param bandwidth bandwidth used for the KDE
|
||||
|
||||
*/
|
||||
template <class InputIt>
|
||||
inline double jkqtpstatEvaluateKernelSum(double t, InputIt first, InputIt last, const std::function<double(double)>& kernel, double bandwidth) {
|
||||
double res=0;
|
||||
size_t cnt=0;
|
||||
for (auto it=first; it!=last; ++it) {
|
||||
const double v=jkqtp_todouble(*it);
|
||||
if (JKQTPIsOKFloat(v)) {
|
||||
const double vx=(t-v)/bandwidth;
|
||||
res+=kernel(vx);
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
return res/static_cast<double>(cnt)/bandwidth;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*! \brief calculate an autoranged 1-dimensional Kernel Density Estimation (KDE) from the given data range \a first ... \a last, bins defined by their number
|
||||
\ingroup jkqtptools_math_statistics_1dkde
|
||||
|
||||
\tparam InputIt standard iterator type of \a first and \a last.
|
||||
\tparam OutputIt standard output iterator type used for the outliers output \a KDEXOut and \a KDEYOut, use e.g. std::back_inserter
|
||||
\param first iterator pointing to the first item in the dataset to use \f$ X_1 \f$
|
||||
\param last iterator pointing behind the last item in the dataset to use \f$ X_N \f$
|
||||
\param kernel the kernel function to use (e.g. jkqtpstatKernel1DGaussian() )
|
||||
\param bandwidth bandwidth used for the KDE
|
||||
\param[out] KDEXOut output iterator that receives x-positions of the KDE bins. Location of this value inside the bin range is defined by \a binXMode
|
||||
\param[out] KDEYOut output iterator that receives counts/frequencies of the KDE bins
|
||||
\param Nout number datapoints in the output KDE
|
||||
\param cummulative if \c true, a cummulative KDE is calculated
|
||||
|
||||
This function performs <a href="https://en.wikipedia.org/wiki/Kernel_density_estimation">Kernel Density Estimation</a> for a given data array.
|
||||
Then the resulting density is evaluated on a regular grid spanning [min(X)...max(X)] with bins datapoints in between.
|
||||
|
||||
\warning this functions is getting very slow for large dataset, as for each point in the resulting histogram N kernel functions have to be evaluated.
|
||||
|
||||
\see en.wikipedia.org/wiki/Kernel_density_estimation, \ref JKQTPlotterBasicJKQTPDatastoreStatistics
|
||||
*/
|
||||
template <class InputIt, class OutputIt>
|
||||
inline void jkqtpstatKDE1DAutoranged(InputIt first, InputIt last, OutputIt KDEXOut, OutputIt KDEYOut, int Nout=100, const std::function<double(double)>& kernel=std::function<double(double)>(&jkqtpstatKernel1DGaussian), double bandwidth=1.0, bool cummulative=false) {
|
||||
double minV=0, maxV=0;
|
||||
size_t N=0;
|
||||
jkqtpstatMinMax<InputIt>(first, last, minV, maxV, nullptr, nullptr, &N);
|
||||
|
||||
std::vector<double> histX;
|
||||
std::vector<double> histY;
|
||||
|
||||
const double range=maxV-minV;
|
||||
const double binw=range/static_cast<double>(Nout);
|
||||
|
||||
// calculate the KDE
|
||||
for (int i=0; i<Nout; i++) {
|
||||
const double x=minV+static_cast<double>(i)*binw+binw/2.0;
|
||||
histX.push_back(x);
|
||||
histY.push_back(jkqtpstatEvaluateKernelSum(x, first, last, kernel, bandwidth));
|
||||
}
|
||||
|
||||
|
||||
// output the KDE
|
||||
double h=0;
|
||||
for (size_t i=0; i<histX.size(); i++) {
|
||||
*++KDEXOut=histX[i];
|
||||
if (cummulative) h+=histY[i];
|
||||
else h=histY[i];
|
||||
*++KDEYOut=h;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*! \brief calculate an autoranged 1-dimensional Kernel Density Estimation (KDE) from the given data range \a first ... \a last, bins defined by their number
|
||||
\ingroup jkqtptools_math_statistics_1dkde
|
||||
|
||||
\tparam InputIt standard iterator type of \a first and \a last.
|
||||
\tparam OutputIt standard output iterator type used for the outliers output \a KDEXOut and \a KDEYOut, use e.g. std::back_inserter
|
||||
\param first iterator pointing to the first item in the dataset to use \f$ X_1 \f$
|
||||
\param last iterator pointing behind the last item in the dataset to use \f$ X_N \f$
|
||||
\param kernel the kernel function to use (e.g. jkqtpstatKernel1DGaussian() )
|
||||
\param bandwidth bandwidth used for the KDE
|
||||
\param[out] KDEXOut output iterator that receives x-positions of the KDE bins. Location of this value inside the bin range is defined by \a binXMode
|
||||
\param[out] KDEYOut output iterator that receives counts/frequencies of the KDE bins
|
||||
\param binWidth width of the bins
|
||||
\param cummulative if \c true, a cummulative KDE is calculated
|
||||
|
||||
This function performs <a href="https://en.wikipedia.org/wiki/Kernel_density_estimation">Kernel Density Estimation</a> for a given data array.
|
||||
Then the resulting density is evaluated on a regular grid spanning [min(X)...max(X)] with bins datapoints in between.
|
||||
|
||||
\warning this functions is getting very slow for large dataset, as for each point in the resulting histogram N kernel functions have to be evaluated.
|
||||
|
||||
\see en.wikipedia.org/wiki/Kernel_density_estimation, \ref JKQTPlotterBasicJKQTPDatastoreStatistics
|
||||
*/
|
||||
template <class InputIt, class OutputIt>
|
||||
inline void jkqtpstatKDE1DAutoranged(InputIt first, InputIt last, OutputIt KDEXOut, OutputIt KDEYOut, double binWidth, const std::function<double(double)>& kernel=std::function<double(double)>(&jkqtpstatKernel1DGaussian), double bandwidth=1.0, bool cummulative=false) {
|
||||
double minV=0, maxV=0;
|
||||
size_t N=0;
|
||||
jkqtpstatMinMax<InputIt>(first, last, minV, maxV, nullptr, nullptr, &N);
|
||||
|
||||
std::vector<double> histX;
|
||||
std::vector<double> histY;
|
||||
|
||||
const double range=maxV-minV;
|
||||
const double binw=binWidth;
|
||||
const int Nout=static_cast<int>(ceil(range/binWidth));
|
||||
|
||||
// calculate the KDE
|
||||
for (int i=0; i<Nout; i++) {
|
||||
histX.push_back(minV+static_cast<double>(i)*binw+binw/2.0);
|
||||
histY.push_back(jkqtpstatEvaluateKernelSum(*(histX.end()), first, last, kernel, bandwidth));
|
||||
}
|
||||
|
||||
|
||||
// output the KDE
|
||||
|
||||
double h=0;
|
||||
for (size_t i=0; i<histX.size(); i++) {
|
||||
*++KDEXOut=histX[i];
|
||||
if (cummulative) h+=histY[i];
|
||||
else h=histY[i];
|
||||
*++KDEYOut=h;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*! \brief calculate an autoranged 1-dimensional Kernel Density Estimation (KDE) from the given data range \a first ... \a last, bins defined the range \a binsFirst ... \a binsLast
|
||||
\ingroup jkqtptools_math_statistics_1dkde
|
||||
|
||||
\tparam InputIt standard iterator type of \a first and \a last.
|
||||
\tparam BinsInputIt standard iterator type of \a binsFirst and \a binsLast.
|
||||
\tparam OutputIt standard output iterator type used for the outliers output \a KDEXOut and \a KDEYOut, use e.g. std::back_inserter
|
||||
\param first iterator pointing to the first item in the dataset to use \f$ X_1 \f$
|
||||
\param last iterator pointing behind the last item in the dataset to use \f$ X_N \f$
|
||||
\param binsFirst iterator pointing to the first item in the set of KDE bins
|
||||
\param binsLast iterator pointing behind the last item in the set of KDE bins
|
||||
\param[out] KDEXOut output iterator that receives x-positions of the KDE bins. Location of this value inside the bin range is defined by \a binXMode
|
||||
\param[out] KDEYOut output iterator that receives counts/frequencies of the KDE bins
|
||||
\param cummulative if \c true, a cummulative KDE is calculated
|
||||
|
||||
\see en.wikipedia.org/wiki/Kernel_density_estimation, \ref JKQTPlotterBasicJKQTPDatastoreStatistics
|
||||
*/
|
||||
template <class InputIt, class BinsInputIt, class OutputIt>
|
||||
inline void jkqtpstatKDE1D(InputIt first, InputIt last, BinsInputIt binsFirst, BinsInputIt binsLast, OutputIt KDEXOut, OutputIt KDEYOut, const std::function<double(double)>& kernel=std::function<double(double)>(&jkqtpstatKernel1DGaussian), double bandwidth=1.0, bool cummulative=false) {
|
||||
double minV=0, maxV=0;
|
||||
size_t N=0;
|
||||
jkqtpstatMinMax<InputIt>(first, last, minV, maxV, nullptr, nullptr, &N);
|
||||
|
||||
std::vector<double> histX;
|
||||
std::vector<double> histY;
|
||||
|
||||
|
||||
// initialize the KDE
|
||||
for (auto it=binsFirst; it!=binsLast; ++it) {
|
||||
histX.push_back(jkqtp_todouble(*it));
|
||||
}
|
||||
std::sort(histX.begin(), histX.end());
|
||||
|
||||
// calculate the KDE
|
||||
for (auto it=histX.begin(); it!=histX.end(); ++it) {
|
||||
histY.push_back(jkqtpstatEvaluateKernelSum(*it, first, last, kernel, bandwidth));
|
||||
}
|
||||
|
||||
|
||||
// output the KDE
|
||||
double h=0;
|
||||
for (size_t i=0; i<histX.size(); i++) {
|
||||
*++KDEXOut=histX[i];
|
||||
if (cummulative) h+=histY[i];
|
||||
else h=histY[i];
|
||||
*++KDEYOut=h;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*! \brief calculate an autoranged 1-dimensional Kernel Density Estimation (KDE) from the given data range \a first ... \a last, evaluation positions are given by the range \a binXLeft ... \a binXRight (in steps of \a binxDelta )
|
||||
\ingroup jkqtptools_math_statistics_1dkde
|
||||
|
||||
\tparam InputIt standard iterator type of \a first and \a last.
|
||||
\tparam OutputIt standard output iterator type used for the outliers output \a KDEXOut and \a KDEYOut, use e.g. std::back_inserter
|
||||
\param first iterator pointing to the first item in the dataset to use \f$ X_1 \f$
|
||||
\param last iterator pointing behind the last item in the dataset to use \f$ X_N \f$
|
||||
\param binXLeft first x-position, where to evaluate the KDE
|
||||
\param binXDelta distance between two x-positions at which the KDE is evaluated
|
||||
\param binXRight last x-position, where to evaluate the KDE
|
||||
\param[out] KDEXOut output iterator that receives x-positions of the KDE bins. Location of this value inside the bin range is defined by \a binXMode
|
||||
\param[out] KDEYOut output iterator that receives counts/frequencies of the KDE bins
|
||||
\param cummulative if \c true, a cummulative KDE is calculated
|
||||
|
||||
\see en.wikipedia.org/wiki/Kernel_density_estimation, \ref JKQTPlotterBasicJKQTPDatastoreStatistics
|
||||
*/
|
||||
template <class InputIt, class OutputIt>
|
||||
inline void jkqtpstatKDE1D(InputIt first, InputIt last, double binXLeft, double binXDelta, double binXRight, OutputIt KDEXOut, OutputIt KDEYOut, const std::function<double(double)>& kernel=std::function<double(double)>(&jkqtpstatKernel1DGaussian), double bandwidth=1.0, bool cummulative=false) {
|
||||
double minV=0, maxV=0;
|
||||
size_t N=0;
|
||||
jkqtpstatMinMax<InputIt>(first, last, minV, maxV, nullptr, nullptr, &N);
|
||||
|
||||
std::vector<double> histX;
|
||||
std::vector<double> histY;
|
||||
|
||||
|
||||
// calculate the KDE
|
||||
for (double x=binXLeft; x<=binXRight; x+=binXDelta) {
|
||||
histX.push_back(x);
|
||||
histY.push_back(jkqtpstatEvaluateKernelSum(x, first, last, kernel, bandwidth));
|
||||
}
|
||||
|
||||
|
||||
// output the KDE
|
||||
double h=0;
|
||||
for (size_t i=0; i<histX.size(); i++) {
|
||||
*++KDEXOut=histX[i];
|
||||
if (cummulative) h+=histY[i];
|
||||
else h=histY[i];
|
||||
*++KDEYOut=h;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // JKQTPSTATISTICSTOOLS_H_INCLUDED
|
||||
|
||||
|
||||
|
@ -12,6 +12,8 @@ isEmpty(JKQTP_COMMON_PRI_INCLUDED) {
|
||||
# To fix error: C2338: va_start argument must not
|
||||
# have reference type and must not be parenthesized
|
||||
DEFINES += _CRT_NO_VA_START_VALIDATION
|
||||
# fix errors with min()/max() macros from windows
|
||||
DEFINES += NOMINMAX
|
||||
}
|
||||
|
||||
HEADERS += $$PWD/jkqtcommon/jkqtp_imexport.h \
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "jkqtplotter/jkqtpdatastorage.h"
|
||||
#include <QDebug>
|
||||
#include <QtGlobal>
|
||||
#include <limits>
|
||||
#include <cmath>
|
||||
|
||||
/**************************************************************************************************************************
|
||||
@ -395,8 +396,9 @@ JKQTPColumnConstIterator JKQTPDatastore::end(size_t i) const
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
JKQTPColumnBackInserter JKQTPDatastore::backInserter(int i)
|
||||
{
|
||||
auto it=columns.find(i);
|
||||
if (i<0 || it==columns.end()) return JKQTPColumnBackInserter(this, std::numeric_limits<size_t>::max());
|
||||
if (i<0) return JKQTPColumnBackInserter(this, std::numeric_limits<size_t>::max());
|
||||
auto it=columns.find(static_cast<size_t>(i));
|
||||
if (it==columns.end()) return JKQTPColumnBackInserter(this, std::numeric_limits<size_t>::max());
|
||||
else return JKQTPColumnBackInserter(this, static_cast<size_t>(i));
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <cstdalign>
|
||||
#include <QString>
|
||||
#include <QMap>
|
||||
#include <QList>
|
||||
@ -85,163 +84,163 @@ enum class JKQTPDatastoreItemFormat {
|
||||
MatrixRow, /*!< \brief a 1D C-array of doubles that represents a number of rows (C standard representation of matrices). The data is stored row after row (=row-major).*/
|
||||
};
|
||||
|
||||
/*! \brief This class manages data columns (with entries of type \c double ), used by JKQTPlotter/JKQTBasePlotter to represent data for plots
|
||||
\ingroup jkqtpdatastorage
|
||||
|
||||
\see \ref JKQTPlotterBasicJKQTPDatastore for a detailed description of how to use this class for data management!
|
||||
|
||||
|
||||
\section jkqtpdatastore_column_management Column Management
|
||||
|
||||
\subsection jkqtpdatastore_column_management_generation Column Generation/Deletion
|
||||
|
||||
A JKQTPDatastore manages a set of data columns. Each column is a continuous vector of numbers. Optionally it can be interpreted
|
||||
as a 2D image. In the latter case, the data is assumed to be ordered in row-major ordering (i.e. row for row).
|
||||
|
||||
You can generate new columns e.g. by:
|
||||
- addColumn() which either generates internally managed (and extensible) columns, or accepts a simple \c double* pointer
|
||||
to external. In the latter case owner-ship may be transferred to the datastore, but can also retain externally.
|
||||
- addImageColumn() adds a column that should be interpreted as an image with given width and height (i.e. a row-major
|
||||
matrix with \c width columns and \c height rows.
|
||||
- copyColumn() duplicates an existing column
|
||||
- addCopiedColumn() copies an external dataset into the datastore. e.g. with code like:
|
||||
\code
|
||||
QVector<double> X, Y;
|
||||
const int Ndata=100;
|
||||
for (int i=0; i<Ndata; i++) {
|
||||
const double x=double(i)/double(Ndata)*8.0*M_PI;
|
||||
X<<x;
|
||||
Y<<sin(x);
|
||||
}
|
||||
plot.addGraph(linegraph=new JKQTPXYLineGraph(&plot));
|
||||
// by calling JKQTPDatastore::addCopiedColumn() the data is COPIED from the vector into the datastore
|
||||
linegraph->setXColumn(datastore->addCopiedColumn(X, "x"));
|
||||
linegraph->setYColumn(datastore->addCopiedColumn(Y, "y"));
|
||||
\endcode
|
||||
- addLinearColumn() adds a column with linearly increasing numbers (in a given range)
|
||||
- addLogColumn() and addDecadeLogColumn() add columns with logarithmically spaced values
|
||||
- addLinearGridColumns() adds two columns which represent x- and y- coordinates of points
|
||||
on a rectangular grid (useful for calculating image data)
|
||||
- addCalculatedColumn() calculates a column, based on row numbers and a C++ functor
|
||||
- addColumnCalculatedFromColumn() calculates a column, based on another column data
|
||||
- addCopiedMap() copies data from a std::map/QMap into two columns
|
||||
- ... several more functions for specific cases exist.
|
||||
- Also note that there are even library extensions that allow to import data directly from OpenCV matrices: JKQTPCopyCvMatToColumn()
|
||||
.
|
||||
|
||||
Of course columns can also be deleted by calling:
|
||||
- deleteColumn()
|
||||
- deleteAllColumns()
|
||||
- deleteAllPrefixedColumns()
|
||||
- clear()
|
||||
.
|
||||
|
||||
\subsection jkqtpdatastore_column_management_props Column Properties
|
||||
|
||||
The properties of columns may be accessed using:
|
||||
- getRows() returns the number of rows in a specific column
|
||||
- getColumnPointer() returns a pointer to the data in the column
|
||||
- getColumnChecksum() calculated a checksum over the data in the column
|
||||
- getColumnNames() / getColumnName()
|
||||
.
|
||||
|
||||
\subsection jkqtpdatastore_column_management_modify Modify Column Contents
|
||||
|
||||
You can modify all data in a column by functions like:
|
||||
- setAll()
|
||||
- scaleColumnValues()
|
||||
.
|
||||
|
||||
Also you can access a single entry from a column, using:
|
||||
- set() / get() set/read a column entry
|
||||
- inc() / dec() increment/decrement a column entry
|
||||
- appendToColumn() (adds a single row/new value to a column, if the column was not internally managed before, it will be copied into a new internal memory segment by the first call to this function!)
|
||||
- appendFromContainerToColumn() (adds several rows from a container to a column, if the column was not internally managed before, it will be copied into a new internal memory segment by the first call to this function!)
|
||||
.
|
||||
|
||||
\subsection jkqtpdatastore_column_management_iterators Iterator Interface
|
||||
|
||||
In addition to teh fucntions above, JKQTPDatastore also provides C++-style iteratos to read the data from a column:
|
||||
- begin()
|
||||
- end()
|
||||
.
|
||||
|
||||
... and also a \c std::back_inserter -style interface to append data to columns:
|
||||
- backInserter()
|
||||
.
|
||||
|
||||
These allow to use the C++ standard algorithms to work with columns and also enabled the
|
||||
library \ref jkqtptools_math_statistics in this software package. You can use the functions
|
||||
above e.g. for code like:
|
||||
|
||||
\code
|
||||
auto inserter it=datastore->backInserter(datastore->addColumn("new column"));
|
||||
for (auto it=datastore->begin(col1); it!=datastore->begin(col1) ++it) {
|
||||
*++inserter=sqrt(*it);
|
||||
}
|
||||
\endcode
|
||||
|
||||
or simply
|
||||
|
||||
\code
|
||||
// mean of a column in a JKQTPDatastore:
|
||||
double mean=jkqtpstatAverage(datastore1->begin(col1), datastore1->end(col1));
|
||||
\endcode
|
||||
|
||||
Also there are functions to add data from iterator-defined ranges, e.g.:
|
||||
- addCopiedColumn()
|
||||
- addCopiedMap()
|
||||
- appendToColumn()
|
||||
.
|
||||
|
||||
|
||||
\subsection jkqtpdatastore_column_management_images Image Column
|
||||
|
||||
JKQTPDatastore stores the width and height of the represented image as metadata with any image column.
|
||||
This metadata is used to provide convenience access to the image pixels with:
|
||||
- setPixel()
|
||||
- getPixel()
|
||||
.
|
||||
|
||||
The image width/height are read using:
|
||||
- getColumnImageWidth()
|
||||
- getColumnImageHeight()
|
||||
.
|
||||
|
||||
This allows to write code like:
|
||||
\code
|
||||
for (int iy=0; iy<10; iy++) {
|
||||
for (int ix=0; ix<10; ix++) {
|
||||
datastore->setPixel(imgColumn, ix, iy, sin(ix*iy/30.0));
|
||||
}
|
||||
}
|
||||
\endcode
|
||||
|
||||
\section jkqtpdatastore_dataio Data Output
|
||||
|
||||
JKQTPDatastore provides several functions that allow to store its contents into files:
|
||||
- saveCSV
|
||||
- saveSYLK()
|
||||
- saveMatlab()
|
||||
- saveDIF()
|
||||
.
|
||||
|
||||
... and function to read data into different data structures:
|
||||
- getData()
|
||||
.
|
||||
|
||||
|
||||
|
||||
|
||||
\section jkqtpdatastore_internals Internal Working
|
||||
|
||||
This class manages a list if JKQTPDatastoreItem onjects that may each contain a chunk of memory, containig
|
||||
one or more columns of data. Each item can be accessed with get() by a specific ID which is returned by add().
|
||||
JKQTPColumn. You may only clear all chunks of memory/items. If you no longer need some of the data, but still want
|
||||
to access the rest you will simply have to destroy all JKQTPColumn that point to the item with their
|
||||
JKQTPColumns:datastoreItem property.
|
||||
|
||||
\verbatim
|
||||
/** \brief This class manages data columns (with entries of type \c double ), used by JKQTPlotter/JKQTBasePlotter to represent data for plots
|
||||
* \ingroup jkqtpdatastorage
|
||||
*
|
||||
* \see \ref JKQTPlotterBasicJKQTPDatastore for a detailed description of how to use this class for data management!
|
||||
*
|
||||
*
|
||||
* \section jkqtpdatastore_column_management Column Management
|
||||
*
|
||||
* \subsection jkqtpdatastore_column_management_generation Column Generation/Deletion
|
||||
*
|
||||
* A JKQTPDatastore manages a set of data columns. Each column is a continuous vector of numbers. Optionally it can be interpreted
|
||||
* as a 2D image. In the latter case, the data is assumed to be ordered in row-major ordering (i.e. row for row).
|
||||
*
|
||||
* You can generate new columns e.g. by:
|
||||
* - addColumn() which either generates internally managed (and extensible) columns, or accepts a simple \c double* pointer
|
||||
* to external. In the latter case owner-ship may be transferred to the datastore, but can also retain externally.
|
||||
* - addImageColumn() adds a column that should be interpreted as an image with given width and height (i.e. a row-major
|
||||
* matrix with \c width columns and \c height rows.
|
||||
* - copyColumn() duplicates an existing column
|
||||
* - addCopiedColumn() copies an external dataset into the datastore. e.g. with code like:
|
||||
* \code{.cpp}
|
||||
* QVector<double> X, Y;
|
||||
* const int Ndata=100;
|
||||
* for (int i=0; i<Ndata; i++) {
|
||||
* * const double x=double(i)/double(Ndata)*8.0*M_PI;
|
||||
* X<<x;
|
||||
* Y<<sin(x);
|
||||
* }
|
||||
* plot.addGraph(linegraph=new JKQTPXYLineGraph(&plot));
|
||||
* // by calling JKQTPDatastore::addCopiedColumn() the data is COPIED from the vector into the datastore
|
||||
* linegraph->setXColumn(datastore->addCopiedColumn(X, "x"));
|
||||
* linegraph->setYColumn(datastore->addCopiedColumn(Y, "y"));
|
||||
* \endcode
|
||||
* - addLinearColumn() adds a column with linearly increasing numbers (in a given range)
|
||||
* - addLogColumn() and addDecadeLogColumn() add columns with logarithmically spaced values
|
||||
* - addLinearGridColumns() adds two columns which represent x- and y- coordinates of points
|
||||
* on a rectangular grid (useful for calculating image data)
|
||||
* - addCalculatedColumn() calculates a column, based on row numbers and a C++ functor
|
||||
* - addColumnCalculatedFromColumn() calculates a column, based on another column data
|
||||
* - addCopiedMap() copies data from a std::map/QMap into two columns
|
||||
* - ... several more functions for specific cases exist.
|
||||
* - Also note that there are even library extensions that allow to import data directly from OpenCV matrices: JKQTPCopyCvMatToColumn()
|
||||
* .
|
||||
*
|
||||
* Of course columns can also be deleted by calling:
|
||||
* - deleteColumn()
|
||||
* - deleteAllColumns()
|
||||
* - deleteAllPrefixedColumns()
|
||||
* - clear()
|
||||
* .
|
||||
*
|
||||
* \subsection jkqtpdatastore_column_management_props Column Properties
|
||||
*
|
||||
* The properties of columns may be accessed using:
|
||||
* - getRows() returns the number of rows in a specific column
|
||||
* - getColumnPointer() returns a pointer to the data in the column
|
||||
* - getColumnChecksum() calculated a checksum over the data in the column
|
||||
* - getColumnNames() / getColumnName()
|
||||
* .
|
||||
*
|
||||
* \subsection jkqtpdatastore_column_management_modify Modify Column Contents
|
||||
*
|
||||
* You can modify all data in a column by functions like:
|
||||
* - setAll()
|
||||
* - scaleColumnValues()
|
||||
* .
|
||||
*
|
||||
* Also you can access a single entry from a column, using:
|
||||
* - set() / get() set/read a column entry
|
||||
* - inc() / dec() increment/decrement a column entry
|
||||
* - appendToColumn() (adds a single row/new value to a column, if the column was not internally managed before, it will be copied into a new internal memory segment by the first call to this function!)
|
||||
* - appendFromContainerToColumn() (adds several rows from a container to a column, if the column was not internally managed before, it will be copied into a new internal memory segment by the first call to this function!)
|
||||
* .
|
||||
*
|
||||
* \subsection jkqtpdatastore_column_management_iterators Iterator Interface
|
||||
*
|
||||
* In addition to teh fucntions above, JKQTPDatastore also provides C++-style iteratos to read the data from a column:
|
||||
* - begin()
|
||||
* - end()
|
||||
* .
|
||||
*
|
||||
* ... and also a \c std::back_inserter -style interface to append data to columns:
|
||||
* - backInserter()
|
||||
* .
|
||||
*
|
||||
* These allow to use the C++ standard algorithms to work with columns and also enabled the
|
||||
* library \ref jkqtptools_math_statistics in this software package. You can use the functions
|
||||
* above e.g. for code like:
|
||||
*
|
||||
* \code{.cpp}
|
||||
* auto inserter it=datastore->backInserter(datastore->addColumn("new column"));
|
||||
* for (auto it=datastore->begin(col1); it!=datastore->begin(col1) ++it) {
|
||||
* *++inserter=sqrt(*it);
|
||||
* }
|
||||
* \endcode
|
||||
*
|
||||
* or simply
|
||||
*
|
||||
* \code{.cpp}
|
||||
* // mean of a column in a JKQTPDatastore:
|
||||
* double mean=jkqtpstatAverage(datastore1->begin(col1), datastore1->end(col1));
|
||||
* \endcode
|
||||
*
|
||||
* Also there are functions to add data from iterator-defined ranges, e.g.:
|
||||
* - addCopiedColumn()
|
||||
* - addCopiedMap()
|
||||
* - appendToColumn()
|
||||
* .
|
||||
*
|
||||
*
|
||||
* \subsection jkqtpdatastore_column_management_images Image Column
|
||||
*
|
||||
* JKQTPDatastore stores the width and height of the represented image as metadata with any image column.
|
||||
* This metadata is used to provide convenience access to the image pixels with:
|
||||
* - setPixel()
|
||||
* - getPixel()
|
||||
* .
|
||||
*
|
||||
* The image width/height are read using:
|
||||
* - getColumnImageWidth()
|
||||
* - getColumnImageHeight()
|
||||
* .
|
||||
*
|
||||
* This allows to write code like:
|
||||
* \code{.cpp}
|
||||
* for (int iy=0; iy<10; iy++) {
|
||||
* for (int ix=0; ix<10; ix++) {
|
||||
* datastore->setPixel(imgColumn, ix, iy, sin(ix*iy/30.0));
|
||||
* }
|
||||
* }
|
||||
* \endcode
|
||||
*
|
||||
* \section jkqtpdatastore_dataio Data Output
|
||||
*
|
||||
* JKQTPDatastore provides several functions that allow to store its contents into files:
|
||||
* - saveCSV
|
||||
* - saveSYLK()
|
||||
* - saveMatlab()
|
||||
* - saveDIF()
|
||||
* .
|
||||
*
|
||||
* ... and function to read data into different data structures:
|
||||
* - getData()
|
||||
* .
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* \section jkqtpdatastore_internals Internal Working
|
||||
*
|
||||
* This class manages a list if JKQTPDatastoreItem onjects that may each contain a chunk of memory, containig
|
||||
* one or more columns of data. Each item can be accessed with get() by a specific ID which is returned by add().
|
||||
* JKQTPColumn. You may only clear all chunks of memory/items. If you no longer need some of the data, but still want
|
||||
* to access the rest you will simply have to destroy all JKQTPColumn that point to the item with their
|
||||
* JKQTPColumns:datastoreItem property.
|
||||
*
|
||||
* \verbatim
|
||||
|
||||
+- JKQTPDatastore ---------------------+ std::vector<JKQTPColumn>:
|
||||
| | +- JKQTPColumn ----------------+
|
||||
@ -269,11 +268,11 @@ enum class JKQTPDatastoreItemFormat {
|
||||
|
||||
|
||||
\endverbatim
|
||||
|
||||
In addition the JKQTPDatastore manages a std::vector<JKQTPColumn> which may be used to access the data chunks in the logical
|
||||
notion of data columns. This class provides a set of interface methods for this list:
|
||||
|
||||
*/
|
||||
*
|
||||
* In addition the JKQTPDatastore manages a std::vector<JKQTPColumn> which may be used to access the data chunks in the logical
|
||||
* notion of data columns. This class provides a set of interface methods for this list:
|
||||
*
|
||||
*/
|
||||
class JKQTP_LIB_EXPORT JKQTPDatastore{
|
||||
private:
|
||||
/** \brief a std::vector that contains all items managed by this datastore */
|
||||
|
@ -48,7 +48,7 @@
|
||||
jkqtpstatAddHBoxplot(plot1->getPlotter(), datastore1->begin(randomdatacol1), datastore1->end(randomdatacol1), -0.3);
|
||||
\endcode
|
||||
|
||||
\see \ref JKQTPlottersimpletest_datastore_statistics, jkqtpstat5NumberStatistics()
|
||||
\see \ref JKQTPlotterBasicJKQTPDatastoreStatistics, jkqtpstat5NumberStatistics()
|
||||
*/
|
||||
template <class InputIt>
|
||||
inline JKQTPBoxplotHorizontalElement* jkqtpstatAddHBoxplot(JKQTBasePlotter* plotter, InputIt first, InputIt last, double boxposY, double quantile1Spec=0.25, double quantile2Spec=0.75, double minimumQuantile=0, double maximumQuantile=1.0, JKQTPStat5NumberStatistics* statOutput=nullptr) {
|
||||
@ -93,7 +93,7 @@ inline JKQTPBoxplotHorizontalElement* jkqtpstatAddHBoxplot(JKQTBasePlotter* plot
|
||||
jkqtpstatAddVBoxplot(plot1->getPlotter(), datastore1->begin(randomdatacol1), datastore1->end(randomdatacol1), -0.3);
|
||||
\endcode
|
||||
|
||||
\see \ref JKQTPlottersimpletest_datastore_statistics, jkqtpstat5NumberStatistics()
|
||||
\see \ref JKQTPlotterBasicJKQTPDatastoreStatistics, jkqtpstat5NumberStatistics()
|
||||
*/
|
||||
template <class InputIt>
|
||||
inline JKQTPBoxplotVerticalElement* jkqtpstatAddVBoxplot(JKQTBasePlotter* plotter, InputIt first, InputIt last, double boxposX, double quantile1Spec=0.25, double quantile2Spec=0.75, double minimumQuantile=0, double maximumQuantile=1.0, JKQTPStat5NumberStatistics* statOutput=nullptr) {
|
||||
@ -143,7 +143,7 @@ inline JKQTPBoxplotVerticalElement* jkqtpstatAddVBoxplot(JKQTBasePlotter* plotte
|
||||
0.05, 0.95 // Quantiles for the boxplot box whiskers' ends
|
||||
\endcode
|
||||
|
||||
\see \ref JKQTPlottersimpletest_datastore_statistics, jkqtpstat5NumberStatistics()
|
||||
\see \ref JKQTPlotterBasicJKQTPDatastoreStatistics, jkqtpstat5NumberStatistics()
|
||||
*/
|
||||
template <class InputIt>
|
||||
inline std::pair<JKQTPBoxplotHorizontalElement*,JKQTPSingleColumnSymbolsGraph*> jkqtpstatAddHBoxplotAndOutliers(JKQTBasePlotter* plotter, InputIt first, InputIt last, double boxposY, double quantile1Spec=0.25, double quantile2Spec=0.75, double minimumQuantile=0.03, double maximumQuantile=0.97, const QString& outliercolumnBaseName=QString("boxplot"), JKQTPStat5NumberStatistics* statOutput=nullptr) {
|
||||
@ -202,7 +202,7 @@ inline std::pair<JKQTPBoxplotHorizontalElement*,JKQTPSingleColumnSymbolsGraph*>
|
||||
0.05, 0.95 // Quantiles for the boxplot box whiskers' ends
|
||||
\endcode
|
||||
|
||||
\see \ref JKQTPlottersimpletest_datastore_statistics, jkqtpstat5NumberStatistics()
|
||||
\see \ref JKQTPlotterBasicJKQTPDatastoreStatistics, jkqtpstat5NumberStatistics()
|
||||
*/
|
||||
template <class InputIt>
|
||||
inline std::pair<JKQTPBoxplotVerticalElement*,JKQTPSingleColumnSymbolsGraph*> jkqtpstatAddVBoxplotAndOutliers(JKQTBasePlotter* plotter, InputIt first, InputIt last, double boxposX, double quantile1Spec=0.25, double quantile2Spec=0.75, double minimumQuantile=0.03, double maximumQuantile=0.97, const QString& outliercolumnBaseName=QString("boxplot"), JKQTPStat5NumberStatistics* statOutput=nullptr) {
|
||||
@ -255,7 +255,7 @@ inline std::pair<JKQTPBoxplotVerticalElement*,JKQTPSingleColumnSymbolsGraph*> jk
|
||||
jkqtpstatAddHHistogram1DAutoranged(plot1->getPlotter(), datastore1->begin(randomdatacol1), datastore1->end(randomdatacol1), 11);
|
||||
\endcode
|
||||
|
||||
\see \ref JKQTPlottersimpletest_datastore_statistics, jkqtpstatHistogram1DAutoranged(), JKQTPBarVerticalGraph
|
||||
\see \ref JKQTPlotterBasicJKQTPDatastoreStatistics, jkqtpstatHistogram1DAutoranged(), JKQTPBarVerticalGraph
|
||||
*/
|
||||
template <class InputIt>
|
||||
inline JKQTPBarVerticalGraph* jkqtpstatAddHHistogram1DAutoranged(JKQTBasePlotter* plotter, InputIt first, InputIt last, int bins=11, bool normalized=true, bool cummulative=false, const QString& histogramcolumnBaseName=QString("histogram")) {
|
||||
@ -290,7 +290,7 @@ inline JKQTPBarVerticalGraph* jkqtpstatAddHHistogram1DAutoranged(JKQTBasePlotter
|
||||
jkqtpstatAddHHistogram1DAutoranged(plot1->getPlotter(), datastore1->begin(randomdatacol1), datastore1->end(randomdatacol1), 0.5);
|
||||
\endcode
|
||||
|
||||
\see \ref JKQTPlottersimpletest_datastore_statistics, jkqtpstatHistogram1DAutoranged(), JKQTPBarVerticalGraph
|
||||
\see \ref JKQTPlotterBasicJKQTPDatastoreStatistics, jkqtpstatHistogram1DAutoranged(), JKQTPBarVerticalGraph
|
||||
*/
|
||||
template <class InputIt>
|
||||
inline JKQTPBarVerticalGraph* jkqtpstatAddHHistogram1DAutoranged(JKQTBasePlotter* plotter, InputIt first, InputIt last, double binWidth, bool normalized=true, bool cummulative=false, const QString& histogramcolumnBaseName=QString("histogram")) {
|
||||
@ -327,7 +327,7 @@ inline JKQTPBarVerticalGraph* jkqtpstatAddHHistogram1DAutoranged(JKQTBasePlotter
|
||||
jkqtpstatAddHHistogram1D(plot1->getPlotter(), datastore1->begin(randomdatacol1), datastore1->end(randomdatacol1), bins.begin(), bins.end());
|
||||
\endcode
|
||||
|
||||
\see \ref JKQTPlottersimpletest_datastore_statistics, jkqtpstatHistogram1D(), JKQTPBarVerticalGraph
|
||||
\see \ref JKQTPlotterBasicJKQTPDatastoreStatistics, jkqtpstatHistogram1D(), JKQTPBarVerticalGraph
|
||||
*/
|
||||
template <class InputIt, class BinsInputIt>
|
||||
inline JKQTPBarVerticalGraph* jkqtpstatAddHHistogram1D(JKQTBasePlotter* plotter, InputIt first, InputIt last, BinsInputIt binsFirst, BinsInputIt binsLast, bool normalized=true, bool cummulative=false, const QString& histogramcolumnBaseName=QString("histogram")) {
|
||||
@ -361,7 +361,7 @@ inline JKQTPBarVerticalGraph* jkqtpstatAddHHistogram1D(JKQTBasePlotter* plotter,
|
||||
jkqtpstatAddVHistogram1DAutoranged(plot1->getPlotter(), datastore1->begin(randomdatacol1), datastore1->end(randomdatacol1), 11);
|
||||
\endcode
|
||||
|
||||
\see \ref JKQTPlottersimpletest_datastore_statistics, jkqtpstatHistogram1DAutoranged(), JKQTPBarHorizontalGraph
|
||||
\see \ref JKQTPlotterBasicJKQTPDatastoreStatistics, jkqtpstatHistogram1DAutoranged(), JKQTPBarHorizontalGraph
|
||||
*/
|
||||
template <class InputIt>
|
||||
inline JKQTPBarHorizontalGraph* jkqtpstatAddVHistogram1DAutoranged(JKQTBasePlotter* plotter, InputIt first, InputIt last, int bins=11, bool normalized=true, bool cummulative=false, const QString& histogramcolumnBaseName=QString("histogram")) {
|
||||
@ -396,7 +396,7 @@ inline JKQTPBarHorizontalGraph* jkqtpstatAddVHistogram1DAutoranged(JKQTBasePlott
|
||||
jkqtpstatAddVHistogram1DAutoranged(plot1->getPlotter(), datastore1->begin(randomdatacol1), datastore1->end(randomdatacol1), 0.5);
|
||||
\endcode
|
||||
|
||||
\see \ref JKQTPlottersimpletest_datastore_statistics, jkqtpstatHistogram1DAutoranged(), JKQTPBarHorizontalGraph
|
||||
\see \ref JKQTPlotterBasicJKQTPDatastoreStatistics, jkqtpstatHistogram1DAutoranged(), JKQTPBarHorizontalGraph
|
||||
*/
|
||||
template <class InputIt>
|
||||
inline JKQTPBarHorizontalGraph* jkqtpstatAddVHistogram1DAutoranged(JKQTBasePlotter* plotter, InputIt first, InputIt last, double binWidth, bool normalized=true, bool cummulative=false, const QString& histogramcolumnBaseName=QString("histogram")) {
|
||||
@ -433,7 +433,7 @@ inline JKQTPBarHorizontalGraph* jkqtpstatAddVHistogram1DAutoranged(JKQTBasePlott
|
||||
jkqtpstatAddVHistogram1D(plot1->getPlotter(), datastore1->begin(randomdatacol1), datastore1->end(randomdatacol1), bins.begin(), bins.end());
|
||||
\endcode
|
||||
|
||||
\see \ref JKQTPlottersimpletest_datastore_statistics, jkqtpstatHistogram1D(), JKQTPBarHorizontalGraph
|
||||
\see \ref JKQTPlotterBasicJKQTPDatastoreStatistics, jkqtpstatHistogram1D(), JKQTPBarHorizontalGraph
|
||||
*/
|
||||
template <class InputIt, class BinsInputIt>
|
||||
inline JKQTPBarHorizontalGraph* jkqtpstatAddVHistogram1D(JKQTBasePlotter* plotter, InputIt first, InputIt last, BinsInputIt binsFirst, BinsInputIt binsLast, bool normalized=true, bool cummulative=false, const QString& histogramcolumnBaseName=QString("histogram")) {
|
||||
@ -478,7 +478,7 @@ inline JKQTPBarHorizontalGraph* jkqtpstatAddVHistogram1D(JKQTBasePlotter* plotte
|
||||
jkqtpstatAddHKDE1DAutoranged(plot1->getPlotter(), datastore1->begin(randomdatacol1), datastore1->end(randomdatacol1), 200);
|
||||
\endcode
|
||||
|
||||
\see \ref JKQTPlottersimpletest_datastore_statistics, jkqtpstatKDE1DAutoranged(), JKQTPXYLineGraph
|
||||
\see \ref JKQTPlotterBasicJKQTPDatastoreStatistics, jkqtpstatKDE1DAutoranged(), JKQTPXYLineGraph
|
||||
*/
|
||||
template <class InputIt>
|
||||
inline JKQTPXYLineGraph* jkqtpstatAddHKDE1DAutoranged(JKQTBasePlotter* plotter, InputIt first, InputIt last, int Nout=100, const std::function<double(double)>& kernel=std::function<double(double)>(&jkqtpstatKernel1DGaussian), double bandwidth=1.0, bool cummulative=false, const QString& KDEcolumnBaseName=QString("KDE")) {
|
||||
@ -516,7 +516,7 @@ inline JKQTPXYLineGraph* jkqtpstatAddHKDE1DAutoranged(JKQTBasePlotter* plotter,
|
||||
jkqtpstatAddHKDE1DAutoranged(plot1->getPlotter(), datastore1->begin(randomdatacol1), datastore1->end(randomdatacol1), 0.01);
|
||||
\endcode
|
||||
|
||||
\see \ref JKQTPlottersimpletest_datastore_statistics, jkqtpstatKDE1DAutoranged(), JKQTPXYLineGraph
|
||||
\see \ref JKQTPlotterBasicJKQTPDatastoreStatistics, jkqtpstatKDE1DAutoranged(), JKQTPXYLineGraph
|
||||
*/
|
||||
template <class InputIt>
|
||||
inline JKQTPXYLineGraph* jkqtpstatAddHKDE1DAutoranged(JKQTBasePlotter* plotter, InputIt first, InputIt last, double binWidth, const std::function<double(double)>& kernel=std::function<double(double)>(&jkqtpstatKernel1DGaussian), double bandwidth=1.0, bool cummulative=false, const QString& KDEcolumnBaseName=QString("KDE")) {
|
||||
@ -556,7 +556,7 @@ inline JKQTPXYLineGraph* jkqtpstatAddHKDE1DAutoranged(JKQTBasePlotter* plotter,
|
||||
jkqtpstatAddHKDE1D(plot1->getPlotter(), datastore1->begin(randomdatacol1), datastore1->end(randomdatacol1), bins.begin(), bins.end());
|
||||
\endcode
|
||||
|
||||
\see \ref JKQTPlottersimpletest_datastore_statistics, jkqtpstatKDE1D(), JKQTPXYLineGraph
|
||||
\see \ref JKQTPlotterBasicJKQTPDatastoreStatistics, jkqtpstatKDE1D(), JKQTPXYLineGraph
|
||||
*/
|
||||
template <class InputIt, class BinsInputIt>
|
||||
inline JKQTPXYLineGraph* jkqtpstatAddHKDE1D(JKQTBasePlotter* plotter, InputIt first, InputIt last, BinsInputIt binsFirst, BinsInputIt binsLast, const std::function<double(double)>& kernel=std::function<double(double)>(&jkqtpstatKernel1DGaussian), double bandwidth=1.0, bool cummulative=false, const QString& KDEcolumnBaseName=QString("KDE")) {
|
||||
@ -595,7 +595,7 @@ inline JKQTPXYLineGraph* jkqtpstatAddHKDE1D(JKQTBasePlotter* plotter, InputIt fi
|
||||
jkqtpstatAddHKDE1D(plot1->getPlotter(), datastore1->begin(randomdatacol1), datastore1->end(randomdatacol1), bins.begin(), bins.end());
|
||||
\endcode
|
||||
|
||||
\see \ref JKQTPlottersimpletest_datastore_statistics, jkqtpstatKDE1D(), JKQTPXYLineGraph
|
||||
\see \ref JKQTPlotterBasicJKQTPDatastoreStatistics, jkqtpstatKDE1D(), JKQTPXYLineGraph
|
||||
*/
|
||||
template <class InputIt>
|
||||
inline JKQTPXYLineGraph* jkqtpstatAddHKDE1D(JKQTBasePlotter* plotter, InputIt first, InputIt last, double binXLeft, double binXDelta, double binXRight, const std::function<double(double)>& kernel=std::function<double(double)>(&jkqtpstatKernel1DGaussian), double bandwidth=1.0, bool cummulative=false, const QString& KDEcolumnBaseName=QString("KDE")) {
|
||||
|
Loading…
Reference in New Issue
Block a user