Kstars
robuststatistics.h
7// The purpose of Robust Statistics is to provide a more robust way of calculating typical statistical measures
8// such as averages. More information is available here: https://en.wikipedia.org/wiki/Robust_statistics
9// The basic idea is that traditional measures of "location" such as the mean are susceptible to outliers in the
10// distribution. More information on location is available here: https://en.wikipedia.org/wiki/Location_parameter
14// Robust Statistics uses underlying GNU Science Library (GSL) routines and provides a wrapper around these routines.
15// See the Statistics section of the GSL documentation: https://www.gnu.org/software/gsl/doc/html/statistics.html
20// LOCATION_TRIMMEDMEAN - discard a specified fraction of high/low values before calculating the mean
33// SCALE_QESTIMATOR https://www.researchgate.net/publication/221996720_Alternatives_to_Median_Absolute_Deviation
37// Where necessary data is sorted by the routines and functionality to use a user selected array sride is included.
38// C++ Templates are used to provide access to the GSL routines based on the datatype of the input data.
60enum ScaleCalculation { SCALE_VARIANCE, SCALE_BWMV, SCALE_SESTIMATOR, SCALE_QESTIMATOR, SCALE_MAD, SCALE_PESTIMATOR };
63enum LocationCalculation { LOCATION_MEAN, LOCATION_MEDIAN, LOCATION_TRIMMEDMEAN, LOCATION_GASTWIRTH,
69 constexpr SampleStatistics() : location(0), scale(0), weight(std::numeric_limits<double>::infinity()) {}
94// virtual double EstimateFromSortedData(const std::vector<Base> &data, const size_t stride = 1) = 0;
122 virtual double EstimateScaleFromSortedData(const std::vector<Base> &data, const size_t stride = 1) = 0;
138 virtual double EstimateScaleFromSortedData(const std::vector<Base> &data, const size_t stride = 1) override
146 virtual double EstimateScaleFromSortedData(const std::vector<Base> &data, const size_t stride = 1) override
159 virtual double EstimateScaleFromSortedData(const std::vector<Base> &data, const size_t stride = 1) override
170 virtual double EstimateScaleFromSortedData(const std::vector<Base> &data, const size_t stride = 1) override
175 return Mathematics::GSLHelpers::gslQnFromSortedData(data.data(), stride, size, work.get(), intWork.get());
182 virtual double EstimateScaleFromSortedData(const std::vector<Base> &data, const size_t stride = 1) override
195 virtual double EstimateScaleFromSortedData(const std::vector<Base> &data, const size_t stride = 1) override
200 auto const adjustedMad = 9.0 * Mathematics::GSLHelpers::gslMAD(theData, stride, size, work.get());
255 virtual double EstimateLocationFromSortedData(const std::vector<Base> &data, const size_t stride = 1) = 0;
259struct StatisticalCoEstimator : public virtual LocationEstimator<Base>, public virtual ScaleEstimator<Base>
265 StatisticalCoEstimator(LocationEstimator<Base> locationEstimator, ScaleEstimator<Base> scaleEstimator)
267 virtual double EstimateLocationFromSortedData(const std::vector<Base> &data, const size_t stride = 1) override
272 virtual double EstimateScaleFromSortedData(const std::vector<Base> &data, const size_t stride = 1) override
277 virtual SampleStatistics EstimateStatisticsFromSortedData(const std::vector<Base> &data, const size_t stride = 1)
313 * @param trimAmount When using the trimmed mean estimate, the percentage quartile to remove either side.
316 * @param stride The stide of the data. Note that in cases other than the simple mean, the stride will only apply
339 * @param stride The stide of the data. Note that in cases other than the simple variance, the stride will only
343double ComputeWeight(const ScaleCalculation scaleMethod, std::vector<Base> data, const size_t stride = 1)
351double ComputeWeightFromSortedData(const ScaleCalculation scaleMethod, const std::vector<Base> &data,
377 // MAD, Sn, Qn and Pn estimators are all calibrated to estimate the standard deviation of Gaussians.
QVariant location(const QVariant &res)
const QList< QKeySequence > & begin()
const QList< QKeySequence > & end()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:04:45 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:04:45 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.