1 | // $Id: tScore.h 469 2005-12-19 14:58:29Z peter $ |
---|
2 | |
---|
3 | #ifndef _theplu_statistics_t_score_ |
---|
4 | #define _theplu_statistics_t_score_ |
---|
5 | |
---|
6 | // C++ tools include |
---|
7 | ///////////////////// |
---|
8 | #include <c++_tools/statistics/Score.h> |
---|
9 | #include <c++_tools/gslapi/vector.h> |
---|
10 | |
---|
11 | #include <gsl/gsl_cdf.h> |
---|
12 | |
---|
13 | |
---|
14 | namespace theplu { |
---|
15 | namespace statistics { |
---|
16 | |
---|
17 | /// |
---|
18 | /// Class for Fisher's t-test. |
---|
19 | /// |
---|
20 | class tScore : public Score |
---|
21 | { |
---|
22 | |
---|
23 | public: |
---|
24 | /// |
---|
25 | /// Default Constructor. |
---|
26 | /// |
---|
27 | tScore(bool absolute=true); |
---|
28 | |
---|
29 | /// |
---|
30 | /// Calculates the value of t-score, i.e. the ratio between |
---|
31 | /// difference in mean and standard deviation of this |
---|
32 | /// difference. \f$ \frac{ \vert \frac{1}{n_x}\sum x_i - |
---|
33 | /// \frac{1}{n_y}\sum y_i \vert } {\frac{\sum x_i^2 + \sum |
---|
34 | /// y_i^2}{n_x-1+n_y-1}} \f$ |
---|
35 | /// |
---|
36 | /// @return t-score if absolute=true |
---|
37 | /// absolute value of t-score is returned |
---|
38 | /// |
---|
39 | double score(const classifier::Target& target, |
---|
40 | const classifier::VectorAbstract& value); |
---|
41 | |
---|
42 | /// |
---|
43 | /// Weighted version of t-Score @return t-score if absolute=true |
---|
44 | /// absolute value of t-score is returned |
---|
45 | /// |
---|
46 | double score(const classifier::Target& target, |
---|
47 | const classifier::VectorAbstract& value, |
---|
48 | const classifier::VectorAbstract& weight); |
---|
49 | |
---|
50 | /// |
---|
51 | ///Calculates the p-value, i.e. the probability of observing a |
---|
52 | ///t-score equally or larger if the null hypothesis is true. If P |
---|
53 | ///is near zero, this casts doubt on this hypothesis. The null |
---|
54 | ///hypothesis is ... @return the one-sided p-value( if |
---|
55 | ///absolute=true is used the two-sided p-value) |
---|
56 | /// |
---|
57 | double p_value() const; |
---|
58 | |
---|
59 | |
---|
60 | |
---|
61 | private: |
---|
62 | double t_; |
---|
63 | int dof_; |
---|
64 | |
---|
65 | }; |
---|
66 | |
---|
67 | }} // of namespace statistics and namespace theplu |
---|
68 | |
---|
69 | #endif |
---|
70 | |
---|