15 #include "TRobustEstimator.h"
36 double Mean(
const std::vector<double>& vx);
45 double MeanError(
const std::vector<double>& vx,
46 const std::vector<double>& vex=std::vector<double>());
54 double MeanMError(
const std::vector<double>& vex);
62 double MeanSError(
const std::vector<double>& vx);
70 double RobustMean(
const std::vector<double>& vx);
99 double TMean(
const std::vector<double>& vx,
119 double WMean(
const std::vector<double>& vx,
128 double Variance(
const std::vector<double>& vx);
138 const std::vector<double>& vex=std::vector<double>());
148 const std::vector<double>& vex=std::vector<double>());
164 double RMS(
const std::vector<double>& vx);
173 double RMSError(
const std::vector<double>& vx,
174 const std::vector<double>& vex=std::vector<double>());
183 double RMSMError(
const std::vector<double>& vx,
184 const std::vector<double>& vex);
192 double RMSSError(
const std::vector<double>& vx);
201 double WRMS(
const std::vector<double>& vx,
211 double Covariance(
const std::vector<double>& vx,
212 const std::vector<double>& vy);
224 const std::vector<double>& vy,
225 const std::vector<double>& vex=std::vector<double>(),
226 const std::vector<double>& vey=std::vector<double>());
238 const std::vector<double>& vy,
239 const std::vector<double>& vex,
240 const std::vector<double>& vey);
250 const std::vector<double>& vy);
311 const std::vector<double>& means,
312 const std::vector<double>& v);
323 const std::vector<double>& means,
324 const std::vector<double>& v);
360 double Median(
const std::vector<double>& vx);
370 const double& density);
379 double LWidth(
const std::vector<double>& vx,
389 double Quantile(
const std::vector<double>& vx,
390 const double& alpha);
402 const double& density);
410 double Mode(
const std::vector<double>& vx);
418 double Min(
const std::vector<double>& vx);
426 double Max(
const std::vector<double>& vx);
481 template<
typename T>
void Trim(std::vector<T>& vx,
491 template<
typename T> std::vector<T>
Trimmed(std::vector<T> vx,
499 template<
typename T>
void Winsorize(std::vector<T>& vx,
509 template<
typename T> std::vector<T>
Winsorized(std::vector<T> vx,
530 template<
typename T> std::vector<T>
Resample(
const std::vector<T>& vx,
532 const bool rep=
true);
534 #include "Statistics-inl.hh"
double Quantile(const std::vector< double > &vx, const double &alpha)
Computes the quantile of a variable sample at probability alpha.
Definition: Statistics.cc:437
double MeanMError(const std::vector< double > &vex)
Computes the measurement error on the mean of a variable sample.
Definition: Statistics.cc:27
double Median(const std::vector< double > &vx)
Computes the median of a variable sample.
Definition: Statistics.cc:404
double DeterminantError(const Matrix< double > &mat, const Matrix< double > &mat_error)
Returns the exact error on the determinant of the covariance matrix.
Definition: Statistics.cc:341
double TMeanSError(const std::vector< double > &vx, const double &frac)
Computes the statistical error on the trimmed mean of a variable sample.
Definition: Statistics.cc:60
double QuantileSError(const size_t n, const double &alpha, const double &density)
Computes the statistical error on the quantile of a variable sample at probability alpha...
Definition: Statistics.cc:452
double GeneralisedDistance(const double &rhoR, const double &rho0)
Returns the generalised distance of a point to a distribution.
Definition: Statistics.cc:536
I RandomElement(I begin, I end)
Randomly select a single element from an array.
Definition: Statistics.hh:84
void DecrementCovariance(const size_t &n, double &cov, const double &xmean, const double &ymean, const double &x, const double &y)
Removes an pair of elements from a precomputed covariance.
Definition: Statistics.cc:236
std::vector< T > Resample(const std::vector< T > &vx, size_t m=0, const bool rep=true)
Randomly resample n data points into m data points with or without replacement.
Definition: Statistics.hh:96
double WMean(const std::vector< double > &vx, const double &frac)
Computes the winsorized mean of a variable sample.
Definition: Statistics.cc:67
double LWidth(const std::vector< double > &vx, const double &p)
Computes the Lebesgues width for a given metric (RMS = L2)
Definition: Statistics.cc:423
void Trim(std::vector< T > &vx, const double &frac)
Trim the n% lowest and n% largest values.
Definition: Statistics.hh:2
double Mode(const std::vector< double > &vx)
Computes the most probable value of the variable sample.
Definition: Statistics.cc:460
double RMSError(const std::vector< double > &vx, const std::vector< double > &vex)
Computes the error on the standard deviation of a variable sample.
Definition: Statistics.cc:145
double Max(const std::vector< double > &vx)
Returns the maximum value in the array.
Definition: Statistics.cc:503
double DeterminantSError(const Matrix< double > &mat)
Returns the statistical error on the determinant of the covariance matrix.
Definition: Statistics.cc:394
Matrix< double > RobustCovarianceMatrix(const Matrix< double > &mat, const double hh)
Returns the MCD robust covariance matrix of a multivariate sample.
Definition: Statistics.cc:281
double CovarianceMError(const std::vector< double > &vx, const std::vector< double > &vy, const std::vector< double > &vex, const std::vector< double > &vey)
Computes the measurement error on the covariance of two variable samples.
Definition: Statistics.cc:206
double Mean(const std::vector< double > &vx)
Computes the mean of a variable sample.
Definition: Statistics.cc:5
double Covariance(const std::vector< double > &vx, const std::vector< double > &vy)
Computes the covariance of two variable samples.
Definition: Statistics.cc:176
double Min(const std::vector< double > &vx)
Returns the minimum value in the array.
Definition: Statistics.cc:492
double VarianceMError(const std::vector< double > &vx, const std::vector< double > &vex)
Computes the measurement error on the variance of a variable sample.
Definition: Statistics.cc:117
double CovarianceSError(const std::vector< double > &vx, const std::vector< double > &vy)
Computes the statistical error on the covariance of two variable samples.
Definition: Statistics.cc:228
std::vector< T > Trimmed(std::vector< T > vx, const double &frac)
Trim the n% lowest and n% largest values.
Definition: Statistics.hh:35
double CovarianceError(const std::vector< double > &vx, const std::vector< double > &vy, const std::vector< double > &vex, const std::vector< double > &vey)
Computes the error on the covariance of two variable samples.
Definition: Statistics.cc:191
double RMSSError(const std::vector< double > &vx)
Computes the statistical error on the standard deviation of a variable sample.
Definition: Statistics.cc:163
void IncrementMean(const size_t &n, double &mean, const double &x)
Adds an element to a precomputed mean.
Definition: Statistics.cc:86
std::vector< T > Winsorized(std::vector< T > vx, const double &frac)
Winsorize to keep only a fraction frac of the original sample.
Definition: Statistics.hh:77
double WRMS(const std::vector< double > &vx, const double &frac)
Computes the winsorized standard deviation of a variable sample.
Definition: Statistics.cc:169
double VarianceSError(const std::vector< double > &vx)
Computes the statistical error on the variance of a variable sample.
Definition: Statistics.cc:133
void Winsorize(std::vector< T > &vx, const double &frac)
Winsorize to keep only a fraction frac of the original sample.
Definition: Statistics.hh:42
double RobustMean(const std::vector< double > &vx)
Computes the MCD robust mean of a variable sample.
Definition: Statistics.cc:44
void IncrementCovarianceMatrix(const size_t &n, Matrix< double > &covmat, const std::vector< double > &means, const std::vector< double > &v)
Adds an element array to a precomputed covariance matrix.
Definition: Statistics.cc:325
double MeanError(const std::vector< double > &vx, const std::vector< double > &vex)
Computes the error on the mean of a variable sample.
Definition: Statistics.cc:16
Matrix< double > CovarianceMatrix(const Matrix< double > &mat)
Returns the covariance matrix of a multivariate sample.
Definition: Statistics.cc:265
double MedianSError(const size_t n, const double &density)
Computes the statistical error on the median of a variable sample.
Definition: Statistics.cc:417
double DeterminantMError(const Matrix< double > &mat, const Matrix< double > &mat_error)
Returns the measurement error on the determinant of the covariance matrix.
Definition: Statistics.cc:354
double Mahalanobis(const Matrix< double > &invcov, const Matrix< double > &vec)
Returns the Mahalanobis distance of a point to a distribution.
Definition: Statistics.cc:514
double MeanSError(const std::vector< double > &vx)
Computes the statistical error on the mean of a variable sample.
Definition: Statistics.cc:38
double GeneralisedDistanceSquared(const double &rhoR, const double &rho0)
Returns the squared generalised distance of a point to a distribution.
Definition: Statistics.cc:542
double MahalanobisSquared(const Matrix< double > &invcov, const Matrix< double > &vec)
Returns the squared Mahalanobis distance of a point to a distribution.
Definition: Statistics.cc:519
void IncrementCovariance(const size_t &n, double &cov, const double &xmean, const double &ymean, const double &x, const double &y)
Adds an pair of elements from a precomputed covariance.
Definition: Statistics.cc:251
double TMean(const std::vector< double > &vx, const double &frac)
Computes the trimmed mean of a variable sample.
Definition: Statistics.cc:53
double Variance(const std::vector< double > &vx)
Computes the variance of a variable sample.
Definition: Statistics.cc:93
void DecrementMean(const size_t &n, double &mean, const double &x)
Removes an element from a precomputed mean.
Definition: Statistics.cc:74
double RMS(const std::vector< double > &vx)
Computes the standard deviation of a variable sample.
Definition: Statistics.cc:139
double VarianceError(const std::vector< double > &vx, const std::vector< double > &vex)
Computes the error on the variance of a variable sample.
Definition: Statistics.cc:106
size_t Factorial(const size_t n)
Returns the factorial of the provided integer.
Definition: Statistics.cc:549
double RMSMError(const std::vector< double > &vx, const std::vector< double > &vex)
Computes the measurement error on the standard deviation of a variable sample.
Definition: Statistics.cc:156
void DecrementCovarianceMatrix(const size_t &n, Matrix< double > &covmat, const std::vector< double > &means, const std::vector< double > &v)
Removes an element array from a precomputed covariance matrix.
Definition: Statistics.cc:307