MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / MAD

Function MAD

src/openms/include/OpenMS/MATH/STATISTICS/StatisticFunctions.h:159–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

157 */
158 template <typename IteratorType>
159 double MAD(IteratorType begin, IteratorType end, double median_of_numbers)
160 {
161 std::vector<double> diffs;
162 diffs.reserve(std::distance(begin, end));
163 for (IteratorType it = begin; it != end; ++it)
164 {
165 diffs.push_back(fabs(*it - median_of_numbers));
166 }
167 return median(diffs.begin(), diffs.end(), false);
168 }
169
170 /**
171 @brief mean absolute deviation (MeanAbsoluteDeviation)

Callers 4

trainMethod · 0.85
calibrateMethod · 0.85
START_SECTIONFunction · 0.85

Calls 5

medianFunction · 0.85
reserveMethod · 0.45
push_backMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by 1

START_SECTIONFunction · 0.68