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

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

File:
1 edited

Legend:

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

    r2555 r3004  
    11#ifndef _theplu_yat_statistics_fisher_
    2 #define _theplu_yat_statistics_fisher_ 
     2#define _theplu_yat_statistics_fisher_
    33
    44// $Id$
     
    77  Copyright (C) 2004, 2005 Peter Johansson
    88  Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
    9   Copyright (C) 2009, 2011 Peter Johansson
     9  Copyright (C) 2009, 2011, 2013 Peter Johansson
    1010
    1111  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2525*/
    2626
     27#include <yat/utility/deprecate.h>
     28
    2729namespace theplu {
    2830namespace yat {
    29 namespace statistics { 
     31namespace statistics {
     32
    3033  /**
    31      @brief Fisher's exact test.   
     34     @brief Fisher's exact test.
    3235
    3336     Fisher's Exact test is a procedure that you can use for data
     
    5255     because a large sample approximation (that the Chi-square test
    5356     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
    5659     @note The statistica assumes that each column and row sum,
    5760     respectively, are fixed. Just because you have a 2x2 table, this
     
    5962     e.g. Barnard's test for alternative.
    6063  */
    61  
     64
    6265  class Fisher
    6366  {
    64  
     67
    6568  public:
    6669    ///
     
    7073
    7174    ///
    72     /// Destructor 
     75    /// Destructor
    7376    ///
    7477    virtual ~Fisher(void);
    75          
    76    
     78
     79
    7780    /**
    7881       The Chi2 score is calculated as \f$ \sum
    7982       \frac{(O_i-E_i)^2}{E_i}\f$ where \a E is expected value and \a
    8083       O is observed value.
     84
     85       \see expected(double&, double&, double&, double&)
    8186
    8287       \return Chi2 score
     
    110115
    111116    /**
     117       Calculates probability to get oddsratio (or smaller).
     118
    112119       If all elements in table is at least minimum_size(), a Chi2
    113120       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
    115140       Otherwise a two-sided p-value is calculated using the
    116141       hypergeometric distribution
     
    120145       \return two-sided p-value
    121146    */
    122     double p_value() const;
    123    
     147    double p_value(void) const;
     148
    124149    ///
    125150    /// One-sided p-value is probability to get larger (or equal) oddsratio.
     
    130155    /// @return One-sided p-value
    131156    ///
    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
    136164       \f[ \begin{tabular}{|c|c|}
    137165       \hline a&b \tabularnewline \hline c&d \tabularnewline \hline
     
    140168       Object will remember the values of \a a, \a b, \a c, and \a d.
    141169
    142        @return odds ratio. 
     170       @return odds ratio.
    143171
    144172       @throw If table is invalid a runtime_error is thrown. A table
    145173       is invalid if a row or column sum is zero.
    146174    */
    147     double oddsratio(const unsigned int a, const unsigned int b, 
     175    double oddsratio(const unsigned int a, const unsigned int b,
    148176                     const unsigned int c, const unsigned int d);
    149177
     
    156184
    157185  private:
    158     bool calculate_p_exact() const;
     186    bool calculate_p_exact(void) const;
    159187
    160188    // two-sided
    161189    double p_value_approximative(void) const;
     190    double p_left_exact(void) const;
     191    double p_right_exact(void) const;
    162192    //two-sided
    163193    double p_value_exact(void) const;
Note: See TracChangeset for help on using the changeset viewer.