# source:trunk/lib/statistics/utility.h@303

Last change on this file since 303 was 303, checked in by Peter, 18 years ago

docs

• Property svn:eol-style set to native
• Property svn:keywords set to Author Date Id Revision
File size: 2.4 KB
Line
1// $Id: utility.h 303 2005-04-30 16:17:35Z peter$
2
3#ifndef _theplu_statistics_utility_
4#define _theplu_statistics_utility_
5
6#include <vector>
7
8namespace theplu {
9namespace statistics {
10
11    ///
12    /// Calculates the probabilty to get \a k or smaller from a
13    /// hypergeometric distribution with parameters \a n1 \a n2 \a
14    /// t. Hypergeomtric situation you get in the following situation:
15    /// Let there be \a n1 ways for a "good" selection and \a n2 ways
16    /// for a "bad" selection out of a total of possibilities. Take \a
17    /// t samples without replacement and \a k of those are "good"
18    /// samples. \a k will follow a hypergeomtric distribution.
19    /// @cumulative hypergeomtric distribution functions P(k).
20    ///
21    double cdf_hypergeometric_P(u_int k, u_int n1, u_int n2, u_int t);
22
23
24    ///
25    /// Median is defined to be value in the middle. If number of
26    /// values is even median is the average of the two middle
27    /// values. @return median
28    ///
29    double median(std::vector<double>&);
30
31    ///
32    /// Median is defined to be value in the middle. If number of
33    /// values is even median is the average of the two middle
34    /// values. @return median
35    ///
36    double median(std::vector<size_t>&);
37
38    ///
39    /// The percentile is determined by the \a p, a number between 0
40    /// and 100. The percentile is found by interpolation, using the
41    /// formula \f$percentile = (1 - \delta) x_i + \delta x_{i+1} \f$
42    /// where \a p is floor\f$((n - 1)p/100)\f$ and \f$\delta \f$ is
43    /// \f$(n-1)p/100 - i \f$.Thus the minimum value of the vector is
44    /// given by p equal to zero, the maximum is given by p equal to
45    /// 100 and the median value is given by p equal to 50.
46    ///
47    /// @return \a i'th percentile
48    ///
49    double percentile(std::vector<double>&, double p);
50
51    ///
52    /// The percentile is determined by the \a p, a number between 0
53    /// and 100. The percentile is found by interpolation, using the
54    /// formula \f$percentile = (1 - \delta) x_i + \delta x_{i+1} \f$
55    /// where \a p is floor\f$((n - 1)p/100)\f$ and \f$\delta \f$ is
56    /// \f$(n-1)p/100 - i \f$.Thus the minimum value of the vector is
57    /// given by p equal to zero, the maximum is given by p equal to
58    /// 100 and the median value is given by p equal to 50.
59    ///
60    /// @return \a i'th percentile
61    ///
62    double percentile(std::vector<size_t>&, double i);
63
64}} // of namespace statistics and namespace theplu
65
66#endif
67
Note: See TracBrowser for help on using the repository browser.