OpenMS
2.7.0
|
Calculates some basic statistical parameters of a distribution: sum, mean, variance, and provides the normal approximation. More...
#include <OpenMS/MATH/STATISTICS/BasicStatistics.h>
Public Types | |
typedef RealT | RealType |
The real type specified as template argument. More... | |
typedef std::vector< RealType > | probability_container |
typedef std::vector< RealType > | coordinate_container |
Public Member Functions | |
BasicStatistics () | |
Default constructor. More... | |
BasicStatistics (BasicStatistics const &arg) | |
Copy constructor. More... | |
BasicStatistics & | operator= (BasicStatistics const &arg) |
Assignment. More... | |
void | clear () |
Set sum, mean, and variance to zero. More... | |
template<typename ProbabilityIterator > | |
void | update (ProbabilityIterator probability_begin, ProbabilityIterator const probability_end) |
This does the actual calculation. More... | |
template<typename ProbabilityIterator , typename CoordinateIterator > | |
void | update (ProbabilityIterator const probability_begin, ProbabilityIterator const probability_end, CoordinateIterator const coordinate_begin) |
This does the actual calculation. More... | |
RealType | mean () const |
Returns the mean. More... | |
void | setMean (RealType const &mean) |
RealType | variance () const |
Returns the variance. More... | |
void | setVariance (RealType const &variance) |
RealType | sum () const |
Returns the sum. More... | |
void | setSum (RealType const &sum) |
RealType | normalDensity_sqrt2pi (RealType coordinate) const |
Returns the density of the normal approximation at point, multiplied by sqrt( 2 * pi ). This saves a division operation compared to normalDensity() More... | |
RealType | normalDensity (RealType const coordinate) const |
See normalDensity_sqrt2pi(). Returns the density of the normal distribution at point. More... | |
void | normalApproximation (probability_container &probability) |
The argument probability is filled with values according to the normal approximation. Its size() is not changed. The approximation takes place at coordinate positions 0, 1, ..., size()-1. More... | |
void | normalApproximation (probability_container &probability, typename probability_container::size_type const size) |
void | normalApproximation (probability_container &probability, coordinate_container const &coordinate) |
The argument probability is filled with values according to the normal approximation. The second argument coordinate contains the positions where the approximation takes place. probability.size() is set to coordinate.size(). More... | |
Static Public Member Functions | |
static RealType | sqrt2pi () |
Returns sqrt( 2 * pi ), which is useful to normalize the result of normalDensity_sqrt2pi(). More... | |
Protected Attributes | |
Protected Members | |
RealType | mean_ |
RealType | variance_ |
RealType | sum_ |
Private Member Functions | |
Private Methods | |
void | normalApproximationHelper_ (probability_container &probability, typename probability_container::size_type const size) |
void | normalApproximationHelper_ (probability_container &probability, coordinate_container const &coordinate) |
Related Functions | |
(Note that these are not member functions.) | |
std::ostream & | operator<< (std::ostream &os, BasicStatistics &arg) |
A convenient overload for debugging purposes. More... | |
Calculates some basic statistical parameters of a distribution: sum, mean, variance, and provides the normal approximation.
The intended usage is as follows:
typedef std::vector<RealType> coordinate_container |
typedef std::vector<RealType> probability_container |
typedef RealT RealType |
The real type specified as template argument.
|
inline |
Default constructor.
|
inline |
Copy constructor.
|
inline |
Set sum, mean, and variance to zero.
|
inline |
Returns the mean.
|
inline |
The argument probability
is filled with values according to the normal approximation. Its size()
is not changed. The approximation takes place at coordinate positions 0, 1, ..., size()-1.
|
inline |
The argument probability is filled with values according to the normal approximation. The second argument coordinate contains the positions where the approximation takes place. probability.size() is set to coordinate.size().
|
inline |
The argument probability
is filled with values according to the normal approximation. Its size() is set to size
. The approximation takes place at coordinate positions 0, 1, ..., size-1.
|
inlineprivate |
References OpenMS::Math::sum().
|
inlineprivate |
References OpenMS::Math::sum().
See normalDensity_sqrt2pi(). Returns the density of the normal distribution at point.
Returns the density of the normal approximation at point, multiplied by sqrt( 2 * pi ). This saves a division operation compared to normalDensity()
References OpenMS::Math::mean(), and OpenMS::Math::variance().
|
inline |
Assignment.
References BasicStatistics< RealT >::mean_, BasicStatistics< RealT >::sum_, and BasicStatistics< RealT >::variance_.
|
inline |
References OpenMS::Math::mean().
|
inline |
References OpenMS::Math::sum().
|
inline |
References OpenMS::Math::variance().
|
inlinestatic |
Returns sqrt( 2 * pi ), which is useful to normalize the result of normalDensity_sqrt2pi().
|
inline |
Returns the sum.
|
inline |
This does the actual calculation.
You can call this as often as you like, using different input vectors.
|
inline |
This does the actual calculation.
You can call this as often as you like, using different input vectors.
Referenced by AsymmetricStatistics< RealT >::update().
|
inline |
Returns the variance.
|
friend |
A convenient overload for debugging purposes.
|
protected |
Referenced by BasicStatistics< RealT >::operator=().
|
protected |
Referenced by BasicStatistics< RealT >::operator=().
|
protected |
Referenced by BasicStatistics< RealT >::operator=().