Changeset 1271 for trunk/yat/statistics
- Timestamp:
- Apr 9, 2008, 6:11:07 PM (14 years ago)
- Location:
- trunk/yat/statistics
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/yat/statistics/Averager.cc
r1122 r1271 37 37 } 38 38 39 Averager::Averager(double x, double xx, u _long n)39 Averager::Averager(double x, double xx, unsigned long n) 40 40 : n_(n), x_(x), xx_(xx) 41 41 { … … 47 47 } 48 48 49 void Averager::add(double d, u _long n)49 void Averager::add(double d, unsigned long n) 50 50 { 51 51 assert(!std::isnan(d)); … … 65 65 } 66 66 67 u _long Averager::n(void) const67 unsigned long Averager::n(void) const 68 68 { 69 69 return n_; -
trunk/yat/statistics/Averager.h
r1186 r1271 30 30 31 31 #include <cmath> 32 #include <sys/types.h>33 32 34 33 namespace theplu{ … … 56 55 /// number of samples \a n. 57 56 /// 58 Averager(double x, double xx, u _long n);57 Averager(double x, double xx, unsigned long n); 59 58 60 59 /// … … 66 65 /// Adding \a n (default=1) number of data point(s) with value \a d. 67 66 /// 68 void add(double d, u _long n=1);67 void add(double d, unsigned long n=1); 69 68 70 69 /** … … 86 85 /// @return Number of data points 87 86 /// 88 u _long n(void) const;87 unsigned long n(void) const; 89 88 90 89 /// … … 179 178 180 179 private: 181 u _long n_;180 unsigned long n_; 182 181 double x_, xx_; 183 182 }; -
trunk/yat/statistics/Fisher.cc
r1000 r1271 72 72 73 73 74 u _int& Fisher::minimum_size(void)74 unsigned int& Fisher::minimum_size(void) 75 75 { 76 76 return minimum_size_; … … 78 78 79 79 80 const u _int& Fisher::minimum_size(void) const80 const unsigned int& Fisher::minimum_size(void) const 81 81 { 82 82 return minimum_size_; … … 84 84 85 85 86 double Fisher::oddsratio(const u _int a,87 const u _int b,88 const u _int c,89 const u _int d)86 double Fisher::oddsratio(const unsigned int a, 87 const unsigned int b, 88 const unsigned int c, 89 const unsigned int d) 90 90 { 91 91 // If a column sum or a row sum is zero, the table is nonsense -
trunk/yat/statistics/Fisher.h
r1000 r1271 28 28 29 29 #include "Score.h" 30 31 #include <sys/types.h>32 30 33 31 #include <cmath> … … 106 104 /// @return reference to minimum_size 107 105 /// 108 u _int& minimum_size(void);106 unsigned int& minimum_size(void); 109 107 110 108 /// … … 114 112 /// @return const reference to minimum_size 115 113 /// 116 const u _int& minimum_size(void) const;114 const unsigned int& minimum_size(void) const; 117 115 118 116 /// … … 150 148 is invalid if a row or column sum is zero. 151 149 */ 152 double oddsratio(const u _int a, const u_int b,153 const u _int c, const u_int d);150 double oddsratio(const unsigned a, const unsigned int b, 151 const unsigned int c, const unsigned int d); 154 152 155 153 private: … … 161 159 double p_value_exact(void) const; 162 160 163 u _int a_;164 u _int b_;165 u _int c_;166 u _int d_;167 u _int minimum_size_;161 unsigned int a_; 162 unsigned int b_; 163 unsigned int c_; 164 unsigned int d_; 165 unsigned int minimum_size_; 168 166 double oddsratio_; 169 167 }; -
trunk/yat/statistics/Histogram.cc
r1203 r1271 118 118 void Histogram::reset(void) 119 119 { 120 for ( u_int i=0; i<histogram_.size(); i++)120 for (size_t i=0; i<histogram_.size(); i++) 121 121 histogram_[i]=0; 122 122 sum_all_.reset(); … … 174 174 << "# column 2: frequency\n"; 175 175 176 for ( u_int i=0; i<histogram.nof_bins(); i++) {176 for (size_t i=0; i<histogram.nof_bins(); i++) { 177 177 s.width(12); 178 178 s << histogram.observation_value(i); -
trunk/yat/statistics/PearsonCorrelation.cc
r1145 r1271 42 42 { 43 43 return pearson_p_value(ap_.correlation(), 44 static_cast<u _int>(ap_.n()));44 static_cast<unsigned int>(ap_.n())); 45 45 } 46 46 -
trunk/yat/statistics/PearsonCorrelation.h
r1145 r1271 70 70 71 71 P-value is calculated using function pearson_p_value(double, 72 u _int) where degrees of freedom is calculated using n(void) in72 unsigned int) where degrees of freedom is calculated using n(void) in 73 73 AveragerPairWeighted. 74 74 -
trunk/yat/statistics/ROC.cc
r1120 r1271 103 103 } 104 104 105 u _int& ROC::minimum_size(void)105 unsigned int& ROC::minimum_size(void) 106 106 { 107 107 return minimum_size_; … … 109 109 110 110 111 const u _int& ROC::minimum_size(void) const111 const unsigned int& ROC::minimum_size(void) const 112 112 { 113 113 return minimum_size_; -
trunk/yat/statistics/ROC.h
r1260 r1271 32 32 #include <map> 33 33 #include <utility> 34 35 #include <sys/types.h>36 34 37 35 namespace theplu { … … 80 78 /// @return reference to minimum_size 81 79 /// 82 u _int& minimum_size(void);80 unsigned int& minimum_size(void); 83 81 84 82 /** … … 88 86 @return const reference to minimum_size 89 87 */ 90 const u _int& minimum_size(void) const;88 const unsigned int& minimum_size(void) const; 91 89 92 90 /// … … 144 142 145 143 double area_; 146 u _int minimum_size_;144 unsigned int minimum_size_; 147 145 double w_neg_; 148 146 double w_pos_; -
trunk/yat/statistics/utility.cc
r1145 r1271 37 37 namespace statistics { 38 38 39 double cdf_hypergeometric_P(u_int k, u_int n1, u_int n2, u_int t) 39 double cdf_hypergeometric_P(unsigned int k, unsigned int n1, 40 unsigned int n2, unsigned int t) 40 41 { 41 42 double p=0; 42 for ( u_int i=0; i<=k; i++)43 for (size_t i=0; i<=k; i++) 43 44 p+= gsl_ran_hypergeometric_pdf(i, n1, n2, t); 44 45 return p; … … 46 47 47 48 48 double pearson_p_value(double r, u _int n)49 double pearson_p_value(double r, unsigned int n) 49 50 { 50 51 assert(n>=2); 51 if (n< 2)52 if (n<=2) 52 53 return std::numeric_limits<double>::quiet_NaN(); 53 54 return gsl_cdf_tdist_Q(r*sqrt((n-2)/(1-r*r)), n-2); -
trunk/yat/statistics/utility.h
r1145 r1271 77 77 /// @return cumulative hypergeomtric distribution functions P(k). 78 78 /// 79 double cdf_hypergeometric_P(u_int k, u_int n1, u_int n2, u_int t); 79 double cdf_hypergeometric_P(unsigned int k, unsigned int n1, 80 unsigned int n2, unsigned int t); 80 81 81 82 … … 93 94 chance when having \a n samples. 94 95 */ 95 double pearson_p_value(double r, u _int n);96 double pearson_p_value(double r, unsigned int n); 96 97 97 98 ///
Note: See TracChangeset
for help on using the changeset viewer.