Ignore:
Timestamp:
Mar 4, 2007, 2:20:01 PM (15 years ago)
Author:
Peter
Message:

added ROCscore class. refs #101

File:
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/yat/statistics/ROCscore.h

    r776 r778  
    1 #ifndef _theplu_yat_statistics_roc_
    2 #define _theplu_yat_statistics_roc_
     1#ifndef _theplu_yat_statistics_roc_score_
     2#define _theplu_yat_statistics_roc_score_
    33
    44// $Id$
     
    2727#include "Score.h"
    2828
    29 #include <utility>
    30 #include <vector>
     29#include <cctype>
    3130
    3231namespace theplu {
     
    4342  /// @brief Class for Reciever Operating Characteristic.
    4443  ///   
    45   /// As the area under an ROC curve is equivalent to Mann-Whitney U
    46   /// statistica, this class can be used to perform a Mann-Whitney
    47   /// U-test (aka Wilcoxon).
    48   ///
    49   class ROC : public Score
     44  class ROCscore : public Score
    5045  {
    5146 
    5247  public:
    53     ///
    54     /// @brief Default constructor
    55     ///
    56     ROC(bool absolute=true);
    57          
    58     ///
    59     /// @brief The destructor
    60     ///
    61     virtual ~ROC(void);
    62          
    63     ///
    64     /// minimum_size is the threshold for when a normal
    65     /// approximation is used for the p-value calculation.
    66     ///
    67     /// @return reference to minimum_size
    68     ///
    69     u_int& minimum_size(void);
    70 
    7148    ///
    7249    /// @return number of samples
     
    7956    size_t n_pos(void) const;
    8057
    81     ///
    82     ///Calculates the p-value, i.e. the probability of observing an
    83     ///area equally or larger if the null hypothesis is true. If P is
    84     ///near zero, this casts doubt on this hypothesis. The null
    85     ///hypothesis is that the values from the 2 classes are generated
    86     ///from 2 identical distributions. The alternative is that the
    87     ///median of the first distribution is shifted from the median of
    88     ///the second distribution by a non-zero amount. If the smallest
    89     ///group size is larger than minimum_size (default = 10), then P
    90     ///is calculated using a normal approximation.  @return the
    91     ///one-sided p-value( if absolute true is used this is equivalent
    92     ///to the two-sided p-value.)
    93     ///
    94     double p_value(void) const;
    95    
    9658    /// Function taking \a value, \a target (+1 or -1) and vector
    9759    /// defining what samples to use. The score is equivalent to
     
    13597                 const utility::vector& weight);
    13698
    137     ///
    138     /// Function returning true if target is positive (binary()) for
    139     /// the sample with ith lowest data value, so i=0 corresponds to
    140     /// the sample with the lowest data value and i=n()-1 the sample
    141     /// with highest data value.
    142     ///
    143     bool target(const size_t i) const;
    144 
    14599  private:
    146100   
    147     /// Implemented as in MatLab 13.1
    148     double get_p_approx(const double) const;
    149 
    150     /// Implemented as in MatLab 13.1
    151     double get_p_exact(const double, const double, const double) const;
    152 
    153     double area_;
    154     u_int minimum_size_;
    155     u_int nof_pos_;
    156     std::vector<std::pair<bool, double> > vec_pair_; // class-value-pair
    157101  };
    158 
    159   ///
    160   /// The output operator for the ROC class. The output is an Nx2
    161   /// matrix, where the first column is the sensitivity and second
    162   /// is the specificity.
    163   ///
    164   std::ostream& operator<< (std::ostream& s, const ROC&);
    165102
    166103}}} // of namespace statistics, yat, and theplu
Note: See TracChangeset for help on using the changeset viewer.