QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
16 #ifndef QGSSTATISTICALSUMMARY_H
17 #define QGSSTATISTICALSUMMARY_H
22 #include "qgis_core.h"
51 CountMissing = 1 << 15,
63 FirstQuartile = 1 << 12,
64 ThirdQuartile = 1 << 13,
65 InterQuartileRange = 1 << 14,
68 All = Count | CountMissing | Sum | Mean | Median | StDev | Max | Min | Range | Minority | Majority | Variety | FirstQuartile | ThirdQuartile | InterQuartileRange | First | Last
70 Q_DECLARE_FLAGS( Statistics, Statistic )
93 void setStatistics( QgsStatisticalSummary::Statistics stats );
104 void calculate(
const QList<double> &values );
121 void addValue(
double value );
138 void addVariant(
const QVariant &value );
160 int count()
const {
return mCount; }
171 double sum()
const {
return mSum; }
177 double mean()
const {
return mMean; }
184 double median()
const {
return mMedian; }
190 double min()
const {
return mMin; }
196 double max()
const {
return mMax; }
202 double range()
const {
return std::isnan( mMax ) || std::isnan( mMin ) ? std::numeric_limits<double>::quiet_NaN() : mMax - mMin; }
210 double first()
const {
return mFirst; }
218 double last()
const {
return mLast; }
226 double stDev()
const {
return mStdev; }
241 int variety()
const {
return mValueCount.count(); }
286 double interQuartileRange()
const {
return std::isnan( mThirdQuartile ) || std::isnan( mFirstQuartile ) ? std::numeric_limits<double>::quiet_NaN() : mThirdQuartile - mFirstQuartile; }
303 Statistics mStatistics;
316 double mFirstQuartile;
317 double mThirdQuartile;
320 QMap< double, int > mValueCount;
321 QList< double > mValues;
322 bool mRequiresAllValueStorage =
false;
323 bool mRequiresHisto =
false;
328 #endif // QGSSTATISTICALSUMMARY_H
Calculator for summary statistics for a list of doubles.
double sampleStDev() const
Returns sample standard deviation.
double firstQuartile() const
Returns the first quartile of the values.
double min() const
Returns calculated minimum from values.
int countMissing() const
Returns the number of missing (null) values.
double minority() const
Returns minority of values.
double interQuartileRange() const
Returns the inter quartile range of the values.
double sum() const
Returns calculated sum of values.
double max() const
Returns calculated maximum from values.
double last() const
Returns the last value obtained.
double stDev() const
Returns population standard deviation.
int count() const
Returns calculated count of values.
double first() const
Returns the first value obtained.
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsField::ConfigurationFlags) CORE_EXPORT QDataStream &operator<<(QDataStream &out
Writes the field to stream out. QGIS version compatibility is not guaranteed.
double majority() const
Returns majority of values.
Statistic
Enumeration of flags that specify statistics to be calculated.
double mean() const
Returns calculated mean of values.
double median() const
Returns calculated median of values.
int variety() const
Returns variety of values.
double range() const
Returns calculated range (difference between maximum and minimum values).
double thirdQuartile() const
Returns the third quartile of the values.
Statistics statistics() const
Returns flags which specify which statistics will be calculated.