QGIS API Documentation
2.14.0-Essen
|
Calculator for summary statistics for a list of doubles. More...
#include <qgsstatisticalsummary.h>
Public Types | |
enum | Statistic { Count = 1, Sum = 2, Mean = 4, Median = 8, StDev = 16, StDevSample = 32, Min = 64, Max = 128, Range = 256, Minority = 512, Majority = 1024, Variety = 2048, FirstQuartile = 4096, ThirdQuartile = 8192, InterQuartileRange = 16384, All = Count | Sum | Mean | Median | StDev | Max | Min | Range | Minority | Majority | Variety | FirstQuartile | ThirdQuartile | InterQuartileRange } |
Enumeration of flags that specify statistics to be calculated. More... | |
Public Member Functions | |
QgsStatisticalSummary (const QgsStatisticalSummary::Statistics &stats=All) | |
Constructor for QgsStatisticalSummary. More... | |
virtual | ~QgsStatisticalSummary () |
void | calculate (const QList< double > &values) |
Calculates summary statistics for a list of values. More... | |
int | count () const |
Returns calculated count of values. More... | |
double | firstQuartile () const |
Returns the first quartile of the values. More... | |
double | interQuartileRange () const |
Returns the inter quartile range of the values. More... | |
double | majority () const |
Returns majority of values. More... | |
double | max () const |
Returns calculated maximum from values. More... | |
double | mean () const |
Returns calculated mean of values. More... | |
double | median () const |
Returns calculated median of values. More... | |
double | min () const |
Returns calculated minimum from values. More... | |
double | minority () const |
Returns minority of values. More... | |
double | range () const |
Returns calculated range (difference between maximum and minimum values). More... | |
void | reset () |
Resets the calculated values. More... | |
double | sampleStDev () const |
Returns sample standard deviation. More... | |
void | setStatistics (const Statistics &stats) |
Sets flags which specify which statistics will be calculated. More... | |
double | statistic (Statistic stat) const |
Returns the value of a specified statistic. More... | |
Statistics | statistics () const |
Returns flags which specify which statistics will be calculated. More... | |
double | stDev () const |
Returns population standard deviation. More... | |
double | sum () const |
Returns calculated sum of values. More... | |
double | thirdQuartile () const |
Returns the third quartile of the values. More... | |
int | variety () const |
Returns variety of values. More... | |
Static Public Member Functions | |
static QString | displayName (Statistic statistic) |
Returns the friendly display name for a statistic. More... | |
Calculator for summary statistics for a list of doubles.
Statistics are calculated by calling calculate and passing a list of doubles. The individual statistics can then be retrieved using the associated methods. Note that not all statistics are calculated by default. Statistics which require slower computations are only calculated by specifying the statistic in the constructor or via setStatistics.
Definition at line 39 of file qgsstatisticalsummary.h.
Enumeration of flags that specify statistics to be calculated.
Definition at line 44 of file qgsstatisticalsummary.h.
QgsStatisticalSummary::QgsStatisticalSummary | ( | const QgsStatisticalSummary::Statistics & | stats = All | ) |
Constructor for QgsStatisticalSummary.
stats | flags for statistics to calculate |
Definition at line 28 of file qgsstatisticalsummary.cpp.
|
virtual |
Definition at line 34 of file qgsstatisticalsummary.cpp.
void QgsStatisticalSummary::calculate | ( | const QList< double > & | values | ) |
Calculates summary statistics for a list of values.
values | list of doubles |
Definition at line 62 of file qgsstatisticalsummary.cpp.
|
inline |
Returns calculated count of values.
Definition at line 102 of file qgsstatisticalsummary.h.
|
static |
Returns the friendly display name for a statistic.
statistic | statistic to return name for |
Definition at line 237 of file qgsstatisticalsummary.cpp.
|
inline |
Returns the first quartile of the values.
The quartile is calculated using the "Tukey's hinges" method.
Definition at line 166 of file qgsstatisticalsummary.h.
|
inline |
Returns the inter quartile range of the values.
The quartiles are calculated using the "Tukey's hinges" method.
Definition at line 180 of file qgsstatisticalsummary.h.
|
inline |
Returns majority of values.
The majority is the value with most occurances in the list This is only calculated if Statistic::Majority has been specified in the constructor or via setStatistics.
Definition at line 159 of file qgsstatisticalsummary.h.
|
inline |
Returns calculated maximum from values.
Definition at line 123 of file qgsstatisticalsummary.h.
|
inline |
Returns calculated mean of values.
Definition at line 110 of file qgsstatisticalsummary.h.
|
inline |
Returns calculated median of values.
This is only calculated if Statistic::Median has been specified in the constructor or via setStatistics.
Definition at line 115 of file qgsstatisticalsummary.h.
|
inline |
Returns calculated minimum from values.
Definition at line 119 of file qgsstatisticalsummary.h.
|
inline |
Returns minority of values.
The minority is the value with least occurances in the list This is only calculated if Statistic::Minority has been specified in the constructor or via setStatistics.
Definition at line 152 of file qgsstatisticalsummary.h.
|
inline |
Returns calculated range (difference between maximum and minimum values).
Definition at line 127 of file qgsstatisticalsummary.h.
void QgsStatisticalSummary::reset | ( | ) |
Resets the calculated values.
Definition at line 39 of file qgsstatisticalsummary.cpp.
|
inline |
Returns sample standard deviation.
This is only calculated if Statistic::StDev has been specified in the constructor or via setStatistics.
Definition at line 139 of file qgsstatisticalsummary.h.
|
inline |
Sets flags which specify which statistics will be calculated.
Some statistics are always calculated (eg sum, min and max).
stats | flags for statistics to calculate |
Definition at line 83 of file qgsstatisticalsummary.h.
double QgsStatisticalSummary::statistic | ( | QgsStatisticalSummary::Statistic | stat | ) | const |
Returns the value of a specified statistic.
stat | statistic to return |
Definition at line 197 of file qgsstatisticalsummary.cpp.
|
inline |
Returns flags which specify which statistics will be calculated.
Some statistics are always calculated (eg sum, min and max).
Definition at line 76 of file qgsstatisticalsummary.h.
|
inline |
Returns population standard deviation.
This is only calculated if Statistic::StDev has been specified in the constructor or via setStatistics.
Definition at line 133 of file qgsstatisticalsummary.h.
|
inline |
Returns calculated sum of values.
Definition at line 106 of file qgsstatisticalsummary.h.
|
inline |
Returns the third quartile of the values.
The quartile is calculated using the "Tukey's hinges" method.
Definition at line 173 of file qgsstatisticalsummary.h.
|
inline |
Returns variety of values.
The variety is the count of unique values from the list. This is only calculated if Statistic::Variety has been specified in the constructor or via setStatistics.
Definition at line 145 of file qgsstatisticalsummary.h.