Changeset 3023
- Timestamp:
- Apr 6, 2013, 4:35:36 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/NEWS
r3018 r3023 8 8 - PearsonCorrelation::one_sided_p(void) is now deprecated (ticket #689) 9 9 - ROC::p_value_one_sided(void is now deprecated (ticket #689) 10 - ROC::area(void) is now declared const (ticket #754) 10 11 11 12 A complete list of closed tickets can be found here [[br]] -
trunk/yat/statistics/ROC.cc
r3006 r3023 66 66 67 67 68 double ROC::area(void) 68 double ROC::area(void) const 69 69 { 70 70 if (std::isnan(area_)){ … … 194 194 double ROC::p_left() const 195 195 { 196 double area(area_); 197 if (std::isnan(area)){ 198 AUC auc(false); 199 area = auc.score(multimap_); 200 } 201 if (std::isnan(area)) 196 if (std::isnan(area())) 202 197 return std::numeric_limits<double>::quiet_NaN(); 203 198 if (use_exact_method()) 204 return p_exact_left(area );205 return get_p_approx(1-area );199 return p_exact_left(area()); 200 return get_p_approx(1-area()); 206 201 } 207 202 … … 209 204 double ROC::p_right() const 210 205 { 211 double area(area_); 212 if (std::isnan(area)){ 213 AUC auc(false); 214 area = auc.score(multimap_); 215 } 216 if (std::isnan(area)) 206 if (std::isnan(area())) 217 207 return std::numeric_limits<double>::quiet_NaN(); 218 208 if (use_exact_method()) 219 return p_exact_right(area );220 return get_p_approx(area );209 return p_exact_right(area()); 210 return get_p_approx(area()); 221 211 } 222 212 … … 224 214 double ROC::p_value() const 225 215 { 226 double area(area_); 227 if (std::isnan(area)){ 228 AUC auc(false); 229 area = auc.score(multimap_); 230 } 231 if (std::isnan(area)) 216 if (std::isnan(area())) 232 217 return std::numeric_limits<double>::quiet_NaN(); 233 218 if (use_exact_method()) { 234 219 double p = 0; 235 double abs_area = std::max(area , 1-area);220 double abs_area = std::max(area(), 1-area()); 236 221 p = p_exact_right(abs_area); 237 222 if (has_ties_) { … … 243 228 return std::min(p, 1.0); 244 229 } 245 return 2*get_p_approx(area );230 return 2*get_p_approx(area()); 246 231 } 247 232 -
trunk/yat/statistics/ROC.h
r3007 r3023 81 81 @return Area under curve. 82 82 */ 83 double area(void) ;83 double area(void) const; 84 84 85 85 /** … … 313 313 bool use_exact_method(void) const; 314 314 315 double area_;315 mutable double area_; 316 316 bool has_ties_; 317 317 unsigned int minimum_size_; -
trunk/yat/statistics/tTest.cc
r2992 r3023 35 35 namespace theplu { 36 36 namespace yat { 37 namespace statistics { 37 namespace statistics { 38 38 39 tTest::tTest(void) 39 tTest::tTest(void) 40 40 : updated_(false) 41 41 { 42 42 } 43 43 44 44 45 45 void tTest::add(double x, bool target, double w) 46 46 { … … 54 54 } 55 55 56 56 57 57 void tTest::reset(void) 58 58 { … … 76 76 77 77 78 double tTest::p_ value(void) const78 double tTest::p_left(void) const 79 79 { 80 double p=2*p_value_one_sided(); 81 return std::min(p,2-p); 80 assert(0 && "not implemented yet"); 82 81 } 83 82 84 83 85 double tTest::p_ value_one_sided(void) const84 double tTest::p_right(void) const 86 85 { 87 86 double t=t_; … … 96 95 } 97 96 97 98 double tTest::p_value(void) const 99 { 100 double p=2*p_right(); 101 return std::min(p,2-p); 102 } 103 104 105 double tTest::p_value_one_sided(void) const 106 { 107 return p_right(); 108 } 109 98 110 }}} // of namespace statistics, yat, and theplu -
trunk/yat/statistics/tTest.h
r2992 r3023 1 1 #ifndef _theplu_yat_statistics_ttest_ 2 #define _theplu_yat_statistics_ttest_ 2 #define _theplu_yat_statistics_ttest_ 3 3 4 4 // $Id$ … … 26 26 27 27 #include "AveragerWeighted.h" 28 #include "yat/utility/deprecate.h" 28 29 29 30 #include <gsl/gsl_cdf.h> … … 31 32 namespace theplu { 32 33 namespace yat { 33 namespace statistics { 34 namespace statistics { 34 35 35 36 /// 36 37 /// @brief Class for Student's t-test. 37 /// 38 /// 38 39 /// See <a href="http://en.wikipedia.org/wiki/Student's_t-test"> 39 40 /// http://en.wikipedia.org/wiki/Student's_t-test</a> for more 40 41 /// details on the t-test. 41 /// 42 /// 42 43 class tTest 43 44 { 44 45 45 46 public: 46 47 /// … … 49 50 tTest(void); 50 51 51 52 52 53 /** 53 54 Adding a data value to tTest. … … 65 66 Calculates the t-score, i.e. the ratio between difference in 66 67 mean and standard deviation of this difference. The t-score is 67 calculated as 68 calculated as 68 69 \f$ t = \frac{ m_x - m_y }{ 69 70 s\sqrt{\frac{1}{n_x}+\frac{1}{n_y}}} \f$ where \f$ m \f$ is the … … 76 77 \see AveragerWeighted 77 78 78 If all weights are equal to unity this boils down to 79 If all weights are equal to unity this boils down to 79 80 \f$ t = \frac{ m_x - m_y } 80 81 {s\sqrt{\frac{1}{n_x}+\frac{1}{n_y}}} \f$ where \f$ m \f$ is … … 84 85 85 86 \see Averager 86 87 87 88 \return t-score. 88 89 */ 89 double score(void); 90 double score(void); 90 91 91 /// 92 /// Calculates the p-value, i.e. the probability of observing a 93 /// t-score equally or larger if the null hypothesis is true. If P 94 /// is near zero, this casts doubt on this hypothesis. The null 95 /// hypothesis is that the means of the two distributions are 96 /// equal. Assumtions for this test is that the two distributions 97 /// are normal distributions with equal variance. The latter 98 /// assumtion is dropped in Welch's t-test. 99 /// 100 /// @return the two-sided p-value 101 /// 92 /** 93 \return the probability of observing a t-score that is equal or 94 smaller than score(). 95 */ 96 double p_left(void) const; 97 98 /** 99 \return the one-sided p-value, i.e., the probability of 100 observing a t-score that is equal or greater than observed 101 here. 102 */ 103 double p_right(void) const; 104 105 /** 106 Calculates the two-sided p-value, i.e., the probability to 107 observe a t-score equal (or greater) than |t| or smaller than 108 -|t|, where t is the observed t-score (returned by score()). 109 110 \return the two-sided p-value 111 */ 102 112 double p_value() const; 103 113 104 /// 105 /// @return One-sided P-value 106 /// 107 double p_value_one_sided(void) const; 114 /** 115 \deprecated Provided for backward compatibility with 0.10 116 API. Use p_right() instead. 117 */ 118 double p_value_one_sided(void) const YAT_DEPRECATE; 108 119 109 120 private: … … 114 125 AveragerWeighted pos_; 115 126 AveragerWeighted neg_; 116 117 127 }; 118 128
Note: See TracChangeset
for help on using the changeset viewer.