Changeset 3004 for trunk/yat/statistics/Fisher.h

Ignore:
Timestamp:
Mar 24, 2013, 1:51:14 AM (10 years ago)
Message:

refs #689. Deprecate Fisher::one_sided_p; implement Fisher::left_p and right_p.

File:
1 edited

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

 r2555 #ifndef _theplu_yat_statistics_fisher_ #define _theplu_yat_statistics_fisher_ #define _theplu_yat_statistics_fisher_ // $Id$ Copyright (C) 2004, 2005 Peter Johansson Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson Copyright (C) 2009, 2011 Peter Johansson Copyright (C) 2009, 2011, 2013 Peter Johansson This file is part of the yat library, http://dev.thep.lu.se/yat */ #include namespace theplu { namespace yat { namespace statistics { namespace statistics { /** @brief Fisher's exact test. @brief Fisher's exact test. Fisher's Exact test is a procedure that you can use for data because a large sample approximation (that the Chi-square test relies on) is very reasonable. If all elements are larger than 10 a Chi-square test is reasonable to use. 10 a Chi-square test is reasonable to use. @note The statistica assumes that each column and row sum, respectively, are fixed. Just because you have a 2x2 table, this e.g. Barnard's test for alternative. */ class Fisher { public: /// /// /// Destructor /// Destructor /// virtual ~Fisher(void); /** The Chi2 score is calculated as \f$\sum \frac{(O_i-E_i)^2}{E_i}\f$ where \a E is expected value and \a O is observed value. \see expected(double&, double&, double&, double&) \return Chi2 score /** Calculates probability to get oddsratio (or smaller). If all elements in table is at least minimum_size(), a Chi2 approximation is used. \since New in yat 0.11 */ double p_left(void) const; /** Calculates probability to get oddsratio (or greater). If all elements in table is at least minimum_size(), a Chi2 approximation is used. \since New in yat 0.11 */ double p_right(void) const; /** If all elements in table is at least minimum_size(), a Chi2 approximation is used. Otherwise a two-sided p-value is calculated using the hypergeometric distribution \return two-sided p-value */ double p_value() const; double p_value(void) const; /// /// One-sided p-value is probability to get larger (or equal) oddsratio. /// @return One-sided p-value /// double p_value_one_sided() const; /** Function calculating odds ratio from 2x2 table /// \deprecated Provided for backward compatibility with the 0.10 /// API. Use p_right() instead. /// double p_value_one_sided() const YAT_DEPRECATE; /** Function calculating odds ratio from 2x2 table \f[ \begin{tabular}{|c|c|} \hline a&b \tabularnewline \hline c&d \tabularnewline \hline Object will remember the values of \a a, \a b, \a c, and \a d. @return odds ratio. @return odds ratio. @throw If table is invalid a runtime_error is thrown. A table is invalid if a row or column sum is zero. */ double oddsratio(const unsigned int a, const unsigned int b, double oddsratio(const unsigned int a, const unsigned int b, const unsigned int c, const unsigned int d); private: bool calculate_p_exact() const; bool calculate_p_exact(void) const; // two-sided double p_value_approximative(void) const; double p_left_exact(void) const; double p_right_exact(void) const; //two-sided double p_value_exact(void) const;
Note: See TracChangeset for help on using the changeset viewer.