Changeset 3004 for trunk/yat/statistics/Fisher.h
- Timestamp:
- Mar 24, 2013, 1:51:14 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/yat/statistics/Fisher.h
r2555 r3004 1 1 #ifndef _theplu_yat_statistics_fisher_ 2 #define _theplu_yat_statistics_fisher_ 2 #define _theplu_yat_statistics_fisher_ 3 3 4 4 // $Id$ … … 7 7 Copyright (C) 2004, 2005 Peter Johansson 8 8 Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson 9 Copyright (C) 2009, 2011 Peter Johansson9 Copyright (C) 2009, 2011, 2013 Peter Johansson 10 10 11 11 This file is part of the yat library, http://dev.thep.lu.se/yat … … 25 25 */ 26 26 27 #include <yat/utility/deprecate.h> 28 27 29 namespace theplu { 28 30 namespace yat { 29 namespace statistics { 31 namespace statistics { 32 30 33 /** 31 @brief Fisher's exact test. 34 @brief Fisher's exact test. 32 35 33 36 Fisher's Exact test is a procedure that you can use for data … … 52 55 because a large sample approximation (that the Chi-square test 53 56 relies on) is very reasonable. If all elements are larger than 54 10 a Chi-square test is reasonable to use. 55 57 10 a Chi-square test is reasonable to use. 58 56 59 @note The statistica assumes that each column and row sum, 57 60 respectively, are fixed. Just because you have a 2x2 table, this … … 59 62 e.g. Barnard's test for alternative. 60 63 */ 61 64 62 65 class Fisher 63 66 { 64 67 65 68 public: 66 69 /// … … 70 73 71 74 /// 72 /// Destructor 75 /// Destructor 73 76 /// 74 77 virtual ~Fisher(void); 75 76 78 79 77 80 /** 78 81 The Chi2 score is calculated as \f$ \sum 79 82 \frac{(O_i-E_i)^2}{E_i}\f$ where \a E is expected value and \a 80 83 O is observed value. 84 85 \see expected(double&, double&, double&, double&) 81 86 82 87 \return Chi2 score … … 110 115 111 116 /** 117 Calculates probability to get oddsratio (or smaller). 118 112 119 If all elements in table is at least minimum_size(), a Chi2 113 120 approximation is used. 114 121 122 \since New in yat 0.11 123 */ 124 double p_left(void) const; 125 126 /** 127 Calculates probability to get oddsratio (or greater). 128 129 If all elements in table is at least minimum_size(), a Chi2 130 approximation is used. 131 132 \since New in yat 0.11 133 */ 134 double p_right(void) const; 135 136 /** 137 If all elements in table is at least minimum_size(), a Chi2 138 approximation is used. 139 115 140 Otherwise a two-sided p-value is calculated using the 116 141 hypergeometric distribution … … 120 145 \return two-sided p-value 121 146 */ 122 double p_value( ) const;123 147 double p_value(void) const; 148 124 149 /// 125 150 /// One-sided p-value is probability to get larger (or equal) oddsratio. … … 130 155 /// @return One-sided p-value 131 156 /// 132 double p_value_one_sided() const; 133 134 /** 135 Function calculating odds ratio from 2x2 table 157 /// \deprecated Provided for backward compatibility with the 0.10 158 /// API. Use p_right() instead. 159 /// 160 double p_value_one_sided() const YAT_DEPRECATE; 161 162 /** 163 Function calculating odds ratio from 2x2 table 136 164 \f[ \begin{tabular}{|c|c|} 137 165 \hline a&b \tabularnewline \hline c&d \tabularnewline \hline … … 140 168 Object will remember the values of \a a, \a b, \a c, and \a d. 141 169 142 @return odds ratio. 170 @return odds ratio. 143 171 144 172 @throw If table is invalid a runtime_error is thrown. A table 145 173 is invalid if a row or column sum is zero. 146 174 */ 147 double oddsratio(const unsigned int a, const unsigned int b, 175 double oddsratio(const unsigned int a, const unsigned int b, 148 176 const unsigned int c, const unsigned int d); 149 177 … … 156 184 157 185 private: 158 bool calculate_p_exact( ) const;186 bool calculate_p_exact(void) const; 159 187 160 188 // two-sided 161 189 double p_value_approximative(void) const; 190 double p_left_exact(void) const; 191 double p_right_exact(void) const; 162 192 //two-sided 163 193 double p_value_exact(void) const;
Note: See TracChangeset
for help on using the changeset viewer.