Histogram statistics of unbinned values.
Every call to Fill updates sums to compute the number of effective entries as well as the arithmetic mean and other statistical quantities per dimension:
Definition at line 38 of file RHistStats.hxx.
Classes | |
struct | RDimensionStats |
Statistics for one dimension. More... | |
Public Member Functions | |
RHistStats (std::size_t nDimensions) | |
Construct a statistics object. | |
void | Add (const RHistStats &other) |
Add all entries from another statistics object. | |
void | Clear () |
Clear this statistics object. | |
double | ComputeKurtosis (std::size_t dim=0) const |
Compute the (excess) kurtosis of unbinned values. | |
double | ComputeMean (std::size_t dim=0) const |
Compute the arithmetic mean of unbinned values. | |
double | ComputeNEffectiveEntries () const |
Compute the number of effective entries. | |
double | ComputeSkewness (std::size_t dim=0) const |
Compute the skewness of unbinned values. | |
double | ComputeStdDev (std::size_t dim=0) const |
Compute the standard deviation of unbinned values. | |
double | ComputeVariance (std::size_t dim=0) const |
Compute the variance of unbinned values. | |
template<typename... A> | |
void | Fill (const A &...args) |
Fill an entry into this statistics object. | |
template<typename... A> | |
void | Fill (const std::tuple< A... > &args) |
Fill an entry into this statistics object. | |
template<typename... A> | |
void | Fill (const std::tuple< A... > &args, RWeight weight) |
Fill an entry into this statistics object with a weight. | |
const RDimensionStats & | GetDimensionStats (std::size_t dim=0) const |
std::size_t | GetNDimensions () const |
std::uint64_t | GetNEntries () const |
double | GetSumW () const |
double | GetSumW2 () const |
void | Streamer (TBuffer &) |
ROOT Streamer function to throw when trying to store an object of this class. | |
Private Member Functions | |
template<std::size_t I, typename... A> | |
void | FillImpl (const std::tuple< A... > &args) |
template<std::size_t I, std::size_t N, typename... A> | |
void | FillImpl (const std::tuple< A... > &args, double w) |
Private Attributes | |
std::vector< RDimensionStats > | fDimensionStats |
The sums per dimension. | |
std::uint64_t | fNEntries = 0 |
The number of entries. | |
double | fSumW = 0.0 |
The sum of weights. | |
double | fSumW2 = 0.0 |
The sum of weights squared. | |
#include <ROOT/RHistStats.hxx>
|
inlineexplicit |
Construct a statistics object.
[in] | nDimensions | the number of dimensions, must be > 0 |
Definition at line 94 of file RHistStats.hxx.
|
inline |
Add all entries from another statistics object.
Throws an exception if the number of dimensions are not identical.
[in] | other | another statistics object |
Definition at line 115 of file RHistStats.hxx.
|
inline |
Clear this statistics object.
Definition at line 129 of file RHistStats.hxx.
|
inline |
Compute the (excess) kurtosis of unbinned values.
The kurtosis is based on the fourth standardized moment:
\[ E\left[\left(\frac{X - \mu}{\sigma}\right)^4\right] \]
The excess kurtosis subtracts 3 from the standardized moment to have a value of 0 for a normal distribution:
\[ E\left[\left(\frac{X - \mu}{\sigma}\right)^4\right] - 3 \]
With support for weighted filling and after some rewriting, the (excess kurtosis) is computed as:
\[ \frac{\frac{\sum w_i \cdot x_i^4}{\sum w_i} - 4 \cdot \frac{\sum w_i \cdot x_i^3}{\sum w_i} \cdot \mu + 6 \cdot \frac{\sum w_i \cdot x_i^2}{\sum w_i} \cdot \mu^2 - 3 \cdot \mu^4}{\sigma^4} - 3 \]
[in] | dim | the dimension index, starting at 0 |
Definition at line 269 of file RHistStats.hxx.
|
inline |
Compute the arithmetic mean of unbinned values.
\[ \mu = \frac{\sum w_i \cdot x_i}{\sum w_i} \]
[in] | dim | the dimension index, starting at 0 |
Definition at line 162 of file RHistStats.hxx.
|
inline |
Compute the number of effective entries.
\[ \frac{(\sum w_i)^2}{\sum w_i^2} \]
Definition at line 146 of file RHistStats.hxx.
|
inline |
Compute the skewness of unbinned values.
The skewness is the third standardized moment:
\[ E\left[\left(\frac{X - \mu}{\sigma}\right)^3\right] \]
With support for weighted filling and after some rewriting, it is computed as:
\[ \frac{\frac{\sum w_i \cdot x_i^3}{\sum w_i} - 3 \cdot \frac{\sum w_i \cdot x_i^2}{\sum w_i} \cdot \mu + 2 \cdot \mu^3}{\sigma^3} \]
[in] | dim | the dimension index, starting at 0 |
Definition at line 232 of file RHistStats.hxx.
|
inline |
Compute the standard deviation of unbinned values.
This function computes the uncorrected sample standard deviation:
\[ \sigma = \sqrt{\frac{1}{\sum w_i} \sum(w_i \cdot x_i - \mu)^2} \]
With some rewriting, this is equivalent to:
\[ \sigma = \sqrt{\frac{\sum w_i \cdot x_i^2}{\sum w_i} - \frac{(\sum w_i \cdot x_i)^2}{(\sum w_i)^2}} \]
This function does not include Bessel's correction needed for an unbiased estimator of population variance. In other words, the return value is a biased estimation lower than the actual population standard deviation.
[in] | dim | the dimension index, starting at 0 |
Definition at line 215 of file RHistStats.hxx.
|
inline |
Compute the variance of unbinned values.
This function computes the uncorrected sample variance:
\[ \sigma^2 = \frac{1}{\sum w_i} \sum(w_i \cdot x_i - \mu)^2 \]
With some rewriting, this is equivalent to:
\[ \sigma^2 = \frac{\sum w_i \cdot x_i^2}{\sum w_i} - \mu^2 \]
This function does not include Bessel's correction needed for an unbiased estimator of population variance. In other words, the return value is a biased estimation lower than the actual population variance.
[in] | dim | the dimension index, starting at 0 |
Definition at line 188 of file RHistStats.hxx.
|
inline |
Fill an entry into this statistics object.
For weighted filling, pass an RWeight as the last argument:
Throws an exception if the number of arguments does not match the number of dimensions.
[in] | args | the arguments for each dimension |
std::tuple
for unweighted filling and for weighted filling Definition at line 378 of file RHistStats.hxx.
|
inline |
Fill an entry into this statistics object.
Throws an exception if the number of arguments does not match the number of dimensions.
[in] | args | the arguments for each dimension |
Definition at line 322 of file RHistStats.hxx.
|
inline |
Fill an entry into this statistics object with a weight.
[in] | args | the arguments for each dimension |
[in] | weight | the weight for this entry |
Definition at line 347 of file RHistStats.hxx.
|
inlineprivate |
Definition at line 289 of file RHistStats.hxx.
|
inlineprivate |
Definition at line 298 of file RHistStats.hxx.
|
inline |
Definition at line 108 of file RHistStats.hxx.
|
inline |
Definition at line 102 of file RHistStats.hxx.
|
inline |
Definition at line 104 of file RHistStats.hxx.
|
inline |
Definition at line 105 of file RHistStats.hxx.
|
inline |
Definition at line 106 of file RHistStats.hxx.
|
inline |
ROOT Streamer function to throw when trying to store an object of this class.
Definition at line 397 of file RHistStats.hxx.
|
private |
The sums per dimension.
Definition at line 88 of file RHistStats.hxx.
|
private |
The number of entries.
Definition at line 82 of file RHistStats.hxx.
|
private |
The sum of weights.
Definition at line 84 of file RHistStats.hxx.
|
private |
The sum of weights squared.
Definition at line 86 of file RHistStats.hxx.