Go to the documentation of this file.
28 double normalPDF(
double x,
double mu,
double std);
40 template <
class VECTORLIKE1,
class VECTORLIKE2,
class MATRIXLIKE>
42 const VECTORLIKE1&
x,
const VECTORLIKE2& mu,
const MATRIXLIKE& cov_inv,
43 const bool scaled_pdf =
false)
49 size_t(cov_inv.cols()) ==
size_t(
x.size()) &&
50 size_t(cov_inv.cols()) ==
size_t(mu.size()));
52 static_cast<T
>(-0.5) *
57 cov_inv.det() / ::pow(
58 static_cast<T
>(
M_2PI),
59 static_cast<T
>(cov_inv.rows())));
72 template <
class VECTORLIKE1,
class VECTORLIKE2,
class MATRIXLIKE>
74 const VECTORLIKE1&
x,
const VECTORLIKE2& mu,
const MATRIXLIKE&
cov,
75 const bool scaled_pdf =
false)
83 template <
typename VECTORLIKE,
typename MATRIXLIKE>
85 const VECTORLIKE& d,
const MATRIXLIKE&
cov)
107 template <
typename VECTORLIKE1,
typename MATRIXLIKE1,
typename VECTORLIKE2,
108 typename MATRIXLIKE2>
110 const VECTORLIKE1& mu0,
const MATRIXLIKE1& cov0,
const VECTORLIKE2& mu1,
111 const MATRIXLIKE2& cov1)
115 size_t(mu0.size()) ==
size_t(mu1.size()) &&
116 size_t(mu0.size()) ==
size_t(cov0.rows()) &&
117 size_t(mu0.size()) ==
size_t(cov1.cols()) && cov0.isSquare() &&
119 const size_t N = mu0.size();
120 MATRIXLIKE2 cov1_inv;
122 const VECTORLIKE1 mu_difs = mu0 - mu1;
123 return 0.5 * (log(cov1.det() / cov0.det()) + (cov1_inv * cov0).trace() +
149 double chi2inv(
double P,
unsigned int dim = 1);
172 unsigned int degreesOfFreedom,
double noncentrality,
double arg);
187 double chi2CDF(
unsigned int degreesOfFreedom,
double arg);
200 unsigned int degreesOfFreedom,
double arg,
double accuracy = 1e-7);
207 unsigned int degreesOfFreedom,
double noncentrality,
double arg,
217 template <
typename CONTAINER>
219 const CONTAINER&
data,
222 out_lower_conf_interval,
224 out_upper_conf_interval,
225 const double confidenceInterval = 0.1,
const size_t histogramNumBins = 1000)
230 ASSERT_(confidenceInterval > 0 && confidenceInterval < 1);
237 (x_max - x_min) / histogramNumBins;
239 const std::vector<double> H =
241 std::vector<double> Hc;
246 std::lower_bound(Hc.begin(), Hc.end(), confidenceInterval);
249 std::upper_bound(Hc.begin(), Hc.end(), 1 - confidenceInterval);
253 out_lower_conf_interval = x_min + idx_low * binWidth;
254 out_upper_conf_interval = x_min + idx_high * binWidth;
void minimum_maximum(const std::vector< T > &V, T &curMin, T &curMax)
Return the maximum and minimum values of a std::vector.
MATRIXLIKE::Scalar normalPDFInf(const VECTORLIKE1 &x, const VECTORLIKE2 &mu, const MATRIXLIKE &cov_inv, const bool scaled_pdf=false)
Evaluates the multivariate normal (Gaussian) distribution at a given point "x".
CONTAINER::Scalar maximum(const CONTAINER &v)
void cumsum(const CONTAINER1 &in_data, CONTAINER2 &out_cumsum)
void confidenceIntervals(const CONTAINER &data, typename mrpt::math::ContainerType< CONTAINER >::element_t &out_mean, typename mrpt::math::ContainerType< CONTAINER >::element_t &out_lower_conf_interval, typename mrpt::math::ContainerType< CONTAINER >::element_t &out_upper_conf_interval, const double confidenceInterval=0.1, const size_t histogramNumBins=1000)
Return the mean and the 10%-90% confidence points (or with any other confidence value) of a set of sa...
double chi2inv(double P, unsigned int dim=1)
The "quantile" of the Chi-Square distribution, for dimension "dim" and probability 0<P<1 (the inverse...
std::vector< double > histogram(const CONTAINER &v, double limit_min, double limit_max, size_t number_bins, bool do_normalization=false, std::vector< double > *out_bin_centers=nullptr)
Computes the normalized or normal histogram of a sequence of numbers given the number of bins and the...
double mean(const CONTAINER &v)
Computes the mean value of a vector.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
double distance(const TPoint2D &p1, const TPoint2D &p2)
Gets the distance between two points in a 2D space.
double noncentralChi2CDF(unsigned int degreesOfFreedom, double noncentrality, double arg)
#define ASSERT_(f)
Defines an assertion mechanism.
Eigen::Matrix< typename MATRIX::Scalar, MATRIX::ColsAtCompileTime, MATRIX::ColsAtCompileTime > cov(const MATRIX &v)
Computes the covariance matrix from a list of samples in an NxM matrix, where each row is a sample,...
double normalPDF(double x, double mu, double std)
Evaluates the univariate normal (Gaussian) distribution at a given point "x".
typename CONTAINER::value_type element_t
GLsizei GLsizei GLenum GLenum const GLvoid * data
double normalQuantile(double p)
Evaluates the Gaussian distribution quantile for the probability value p=[0,1].
std::pair< double, double > noncentralChi2PDF_CDF(unsigned int degreesOfFreedom, double noncentrality, double arg, double eps=1e-7)
Returns the 'exact' PDF (first) and CDF (second) of a Non-central chi-squared probability distributio...
double KLD_Gaussians(const VECTORLIKE1 &mu0, const MATRIXLIKE1 &cov0, const VECTORLIKE2 &mu1, const MATRIXLIKE2 &cov1)
Kullback-Leibler divergence (KLD) between two independent multivariate Gaussians.
MAT_C::Scalar multiply_HCHt_scalar(const VECTOR_H &H, const MAT_C &C)
r (a scalar) = H * C * H^t (with a vector H and a symmetric matrix C)
#define ASSERTDEB_(f)
Defines an assertion mechanism - only when compiled in debug.
double normalCDF(double p)
Evaluates the Gaussian cumulative density function.
double chi2CDF(unsigned int degreesOfFreedom, double arg)
double chi2PDF(unsigned int degreesOfFreedom, double arg, double accuracy=1e-7)
Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST | |