91 mMin = std::min( mMin, value );
92 mMax = std::max( mMax, value );
96 mValueCount.insert( value, mValueCount.value( value, 0 ) + 1 );
98 if ( mRequiresAllValueStorage )
121 mFirst = std::numeric_limits<double>::quiet_NaN();
122 mLast = std::numeric_limits<double>::quiet_NaN();
123 mMin = std::numeric_limits<double>::quiet_NaN();
124 mMax = std::numeric_limits<double>::quiet_NaN();
125 mMean = std::numeric_limits<double>::quiet_NaN();
126 mMedian = std::numeric_limits<double>::quiet_NaN();
127 mStdev = std::numeric_limits<double>::quiet_NaN();
128 mSampleStdev = std::numeric_limits<double>::quiet_NaN();
129 mMinority = std::numeric_limits<double>::quiet_NaN();
130 mMajority = std::numeric_limits<double>::quiet_NaN();
131 mFirstQuartile = std::numeric_limits<double>::quiet_NaN();
132 mThirdQuartile = std::numeric_limits<double>::quiet_NaN();
136 mMean = mSum / mCount;
140 double sumSquared = 0;
141 const auto constMValues = mValues;
142 for (
const double value : constMValues )
144 const double diff = value - mMean;
145 sumSquared += diff * diff;
147 mStdev = std::pow( sumSquared / mValues.count(), 0.5 );
148 mSampleStdev = std::pow( sumSquared / ( mValues.count() - 1 ), 0.5 );
156 std::sort( mValues.begin(), mValues.end() );
157 const bool even = ( mCount % 2 ) < 1;
160 mMedian = ( mValues[mCount / 2 - 1] + mValues[mCount / 2] ) / 2.0;
164 mMedian = mValues[( mCount + 1 ) / 2 - 1];
171 if ( ( mCount % 2 ) < 1 )
173 const int halfCount = mCount / 2;
174 const bool even = ( halfCount % 2 ) < 1;
177 mFirstQuartile = ( mValues[halfCount / 2 - 1] + mValues[halfCount / 2] ) / 2.0;
181 mFirstQuartile = mValues[( halfCount + 1 ) / 2 - 1];
186 const int halfCount = mCount / 2 + 1;
187 const bool even = ( halfCount % 2 ) < 1;
190 mFirstQuartile = ( mValues[halfCount / 2 - 1] + mValues[halfCount / 2] ) / 2.0;
194 mFirstQuartile = mValues[( halfCount + 1 ) / 2 - 1];
202 if ( ( mCount % 2 ) < 1 )
204 const int halfCount = mCount / 2;
205 const bool even = ( halfCount % 2 ) < 1;
208 mThirdQuartile = ( mValues[ halfCount + halfCount / 2 - 1] + mValues[ halfCount + halfCount / 2] ) / 2.0;
212 mThirdQuartile = mValues[( halfCount + 1 ) / 2 - 1 + halfCount ];
217 const int halfCount = mCount / 2 + 1;
218 const bool even = ( halfCount % 2 ) < 1;
221 mThirdQuartile = ( mValues[ halfCount + halfCount / 2 - 2 ] + mValues[ halfCount + halfCount / 2 - 1 ] ) / 2.0;
225 mThirdQuartile = mValues[( halfCount + 1 ) / 2 - 2 + halfCount ];
232 QList<int> valueCounts = mValueCount.values();
236 mMinority = mValueCount.key( *std::min_element( valueCounts.begin(), valueCounts.end() ) );
240 mMajority = mValueCount.key( *std::max_element( valueCounts.begin(), valueCounts.end() ) );