35 #ifndef OPENMS_MATH_STATISTICS_ASYMMETRICSTATISTICS_H 36 #define OPENMS_MATH_STATISTICS_ASYMMETRICSTATISTICS_H 58 template <
typename RealT =
double>
93 template <
typename ProbabilityIterator,
typename CoordinateIterator>
94 void update(ProbabilityIterator
const probability_begin,
95 ProbabilityIterator
const probability_end,
96 CoordinateIterator
const coordinate_begin)
99 Base::update(probability_begin, probability_end, coordinate_begin);
101 const RealType stdev = std::sqrt(
variance_);
107 ProbabilityIterator prob_iter = probability_begin;
108 CoordinateIterator coord_iter = coordinate_begin;
109 for (; prob_iter != probability_end; ++prob_iter, ++coord_iter)
111 RealType diff = *coord_iter -
mean_;
112 RealType diff_squared = diff * diff;
116 if (*coord_iter < mean_)
129 RealType frac = (diff / stdev + 1.) / 2.;
130 RealType prob_frac = frac * *prob_iter;
133 prob_frac = *prob_iter * (1. - frac);
152 #endif // OPENMS_MATH_STATISTICS_ASYMMETRICSTATISTICS_H RealType variance_
Definition: BasicStatistics.h:258
void update(ProbabilityIterator const probability_begin, ProbabilityIterator const probability_end, CoordinateIterator const coordinate_begin)
You can call this as often as you like, using different input vectors.
Definition: AsymmetricStatistics.h:94
RealType mean_
Definition: BasicStatistics.h:257
BasicStatistics< RealT > Base
The real type and basic statistics specified as template argument.
Definition: AsymmetricStatistics.h:63
void update(ProbabilityIterator probability_begin, ProbabilityIterator const probability_end)
This does the actual calculation.
Definition: BasicStatistics.h:114
Internal class for asymmetric distributions.
Definition: AsymmetricStatistics.h:59
AsymmetricStatistics()
Default constructor.
Definition: AsymmetricStatistics.h:74
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
Calculates some basic statistical parameters of a distribution: sum, mean, variance, and provides the normal approximation.
Definition: BasicStatistics.h:68
RealType variance1_
Definition: AsymmetricStatistics.h:145
RealType variance2_
Definition: AsymmetricStatistics.h:145
RealType variance2() const
"variance to the right hand side"
Definition: AsymmetricStatistics.h:87
RealType variance1() const
"variance to the left hand side"
Definition: AsymmetricStatistics.h:81
void clear()
Set sum, mean, and variance to zero.
Definition: BasicStatistics.h:104
RealType sum_
Definition: BasicStatistics.h:259
RealT RealType
The real type specified as template argument.
Definition: BasicStatistics.h:75
Base::RealType RealType
Definition: AsymmetricStatistics.h:64