source:trunk/src/ROC.h@98

Last change on this file since 98 was 98, checked in by Peter, 19 years ago

• Property svn:eol-style set to `native`
• Property svn:keywords set to `Author Date Id Revision`
File size: 2.1 KB
Line
1// \$Id: ROC.h 98 2004-06-10 15:24:05Z peter \$
2
3#ifndef _theplu_cpptools_roc_
4#define _theplu_cpptools_roc_
5
6// C++ tools include
7/////////////////////
8#include "Score.h"
9#include "vector.h"
10#include <gsl/gsl_cdf.h>
11
12// Standard C++ includes
13////////////////////////
14#include <utility>
15#include <vector>
16
17namespace theplu {
18namespace cpptools {
19  ///
20  /// Class for ROC (Reciever Operating Characteristic).
21  ///
22
23  class ROC : public Score
24  {
25
26  public:
27    ///
28    /// Constructor taking a value vector and a target vector (+1 or -1).
29    ///
30    ROC(const gslapi::vector&, const gslapi::vector&);
31
32    ///
33    /// Destructor
34    ///
35    virtual ~ROC(void) {};
36
37    /// Equivalent to the Mann-Whitney score, but normalized to be
38    /// between zero and one.  @return the area under the ROC curve
39    ///
40    double score();
41
42    ///
43    ///Calculates the p-value, i.e. the probability of observing an area
44    ///equally or larger if the null hypothesis is true. If P is near zero,
45    ///this casts doubt on this hypothesis. The null hypothesis is that the
46    ///values from the 2 classes are generated from 2 identical
47    ///distributions. The alternative is that the median of the first
48    ///distribution is shifted from the median of the second distribution by a
49    ///non-zero amount. If the smallest group size is larger than minimum_size
50    ///(default = 10), then P is calculated using a normal approximation.
51    /// @return the one-sided p-value
52    ///
53    double p_value();
54
55    ///
56    /// Changes minimum_size , i.e. the threshold when a normal
57    /// approximation is used for the p-value calculation.
58    ///
59    inline void minimum_size(const u_int minimum_size) {minimum_size_ = minimum_size; }
60
61  private:
62    std::vector<std::pair<int, double> > value_;
63    double nof_pos_;
64    u_int minimum_size_;
65    double area_;
66    ///
67    ///
68    /// Implemented as in MatLab 13.1
69    /// @return the p-value
70    ///
71    double ROC::get_p_approx(const double);
72
73    ///
74    /// @return the p-value
75    ///
76    double ROC::get_p_exact(const double, const double,
77                            const double);
78
79  };
80
81}} // of namespace cpptools and namespace theplu
82
83#endif
84
Note: See TracBrowser for help on using the repository browser.