16 #ifndef QGSSTATISTICALSUMMARY_H 17 #define QGSSTATISTICALSUMMARY_H 22 #include "qgis_core.h" 65 InterQuartileRange = 16384,
66 All = Count | CountMissing | Sum | Mean | Median | StDev | Max | Min | Range | Minority | Majority | Variety | FirstQuartile | ThirdQuartile | InterQuartileRange
91 void setStatistics( QgsStatisticalSummary::Statistics stats ) { mStatistics = stats; }
102 void calculate(
const QList<double> &values );
119 void addValue(
double value );
136 void addVariant(
const QVariant &value );
158 int count()
const {
return mCount; }
169 double sum()
const {
return mSum; }
175 double mean()
const {
return mMean; }
182 double median()
const {
return mMedian; }
188 double min()
const {
return mMin; }
194 double max()
const {
return mMax; }
200 double range()
const {
return std::isnan( mMax ) || std::isnan( mMin ) ? std::numeric_limits<double>::quiet_NaN() : mMax - mMin; }
208 double stDev()
const {
return mStdev; }
223 int variety()
const {
return mValueCount.count(); }
268 double interQuartileRange()
const {
return std::isnan( mThirdQuartile ) || std::isnan( mFirstQuartile ) ? std::numeric_limits<double>::quiet_NaN() : mThirdQuartile - mFirstQuartile; }
278 Statistics mStatistics;
291 double mFirstQuartile;
292 double mThirdQuartile;
293 QMap< double, int > mValueCount;
294 QList< double > mValues;
297 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsStatisticalSummary::Statistics )
299 #endif // QGSSTATISTICALSUMMARY_H double max() const
Returns calculated maximum from values.
Statistic
Enumeration of flags that specify statistics to be calculated.
int variety() const
Returns variety of values.
double minority() const
Returns minority of values.
double range() const
Returns calculated range (difference between maximum and minimum values).
double median() const
Returns calculated median of values.
double sampleStDev() const
Returns sample standard deviation.
double firstQuartile() const
Returns the first quartile of the values.
double stDev() const
Returns population standard deviation.
double sum() const
Returns calculated sum of values.
double mean() const
Returns calculated mean of values.
double majority() const
Returns majority of values.
double interQuartileRange() const
Returns the inter quartile range of the values.
void setStatistics(QgsStatisticalSummary::Statistics stats)
Sets flags which specify which statistics will be calculated.
int countMissing() const
Returns the number of missing (null) values.
Statistics statistics() const
Returns flags which specify which statistics will be calculated.
int count() const
Returns calculated count of values.
double min() const
Returns calculated minimum from values.
Calculator for summary statistics for a list of doubles.
double thirdQuartile() const
Returns the third quartile of the values.